CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
TrackClusterRemover Class Reference
Inheritance diagram for TrackClusterRemover:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Classes

struct  ParamBlock
 

Public Member Functions

template<typename T >
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)
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup)
 
 TrackClusterRemover (const edm::ParameterSet &iConfig)
 
 ~TrackClusterRemover ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Member Functions

template<typename T >
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)
 
void mergeOld (reco::ClusterRemovalInfo::Indices &refs, const reco::ClusterRemovalInfo::Indices &oldRefs)
 
void process (const TrackingRecHit *hit, float chi2)
 
void process (const OmniClusterRef &cluRef, uint32_t subdet)
 
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)
 

Private Attributes

bool clusterWasteSolution_
 
std::vector< bool > collectedPixels_
 
std::vector< bool > collectedStrips_
 
bool doPixel_
 
bool doStrip_
 
bool filterTracks_
 
bool mergeOld_
 
int minNumberOfLayersWithMeasBeforeFiltering_
 
edm::InputTag oldRemovalInfo_
 
std::vector< edm::InputTagoverrideTrkQuals_
 
ParamBlock pblocks_ [NumberOfParamBlocks]
 
edm::InputTag pixelClusters_
 
std::vector< uint8_t > pixels
 
edm::ProductID pixelSourceProdID
 
edm::InputTag stripClusters_
 
std::vector< uint8_t > strips
 
edm::ProductID stripSourceProdID
 
reco::TrackBase::TrackQuality trackQuality_
 
edm::InputTag trajectories_
 

Static Private Attributes

static const unsigned int NumberOfParamBlocks = 6
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Definition at line 35 of file TrackClusterRemover.cc.

Constructor & Destructor Documentation

TrackClusterRemover::TrackClusterRemover ( const edm::ParameterSet iConfig)

Definition at line 114 of file TrackClusterRemover.cc.

References clusterWasteSolution_, doPixel_, doStrip_, edm::hlt::Exception, edm::ParameterSet::exists(), edm::ParameterSet::existsAs(), lumiContext::fill, filterTracks_, edm::ParameterSet::getParameter(), i, minNumberOfLayersWithMeasBeforeFiltering_, NumberOfParamBlocks, overrideTrkQuals_, pblocks_, reco::TrackBase::qualityByName(), readPSet(), trackQuality_, and reco::TrackBase::undefQuality.

114  :
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")),
123 {
124  if (iConfig.exists("overrideTrkQuals"))
125  overrideTrkQuals_.push_back(iConfig.getParameter<edm::InputTag>("overrideTrkQuals"));
126  if (iConfig.exists("clusterLessSolution"))
127  clusterWasteSolution_=!iConfig.getParameter<bool>("clusterLessSolution");
128  if (doPixel_ && clusterWasteSolution_) produces< edmNew::DetSetVector<SiPixelCluster> >();
129  if (doStrip_ && clusterWasteSolution_) produces< edmNew::DetSetVector<SiStripCluster> >();
130  if (clusterWasteSolution_) produces< ClusterRemovalInfo >();
131 
132  fill(pblocks_, pblocks_+NumberOfParamBlocks, ParamBlock());
133  readPSet(iConfig, "Common",-1);
134  if (doPixel_) {
135  readPSet(iConfig, "Pixel" ,0,1);
136  readPSet(iConfig, "PXB" ,0);
137  readPSet(iConfig, "PXE" ,1);
138  }
139  if (doStrip_) {
140  readPSet(iConfig, "Strip" ,2,3,4,5);
141  readPSet(iConfig, "StripInner" ,2,3);
142  readPSet(iConfig, "StripOuter" ,4,5);
143  readPSet(iConfig, "TIB" ,2);
144  readPSet(iConfig, "TID" ,3);
145  readPSet(iConfig, "TOB" ,4);
146  readPSet(iConfig, "TEC" ,5);
147  }
148 
149  bool usingCharge = false;
150  for (size_t i = 0; i < NumberOfParamBlocks; ++i) {
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.";
154  }
155  }
156 
157  if (!clusterWasteSolution_){
158  produces<edm::ContainerMask<edmNew::DetSetVector<SiPixelCluster> > >();
159  produces<edm::ContainerMask<edmNew::DetSetVector<SiStripCluster> > >();
160  }
162  filterTracks_=false;
163  if (iConfig.exists("TrackQuality")){
164  filterTracks_=true;
165  trackQuality_=reco::TrackBase::qualityByName(iConfig.getParameter<std::string>("TrackQuality"));
166  minNumberOfLayersWithMeasBeforeFiltering_ = iConfig.existsAs<int>("minNumberOfLayersWithMeasBeforeFiltering") ?
167  iConfig.getParameter<int>("minNumberOfLayersWithMeasBeforeFiltering") : 0;
168  }
169 
170 }
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
edm::InputTag stripClusters_
string fill
Definition: lumiContext.py:319
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:187
static const unsigned int NumberOfParamBlocks
ParamBlock pblocks_[NumberOfParamBlocks]
edm::InputTag pixelClusters_
bool exists(std::string const &parameterName) const
checks if a parameter exists
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)
edm::InputTag oldRemovalInfo_
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:46
std::vector< edm::InputTag > overrideTrkQuals_
TrackClusterRemover::~TrackClusterRemover ( )

Definition at line 173 of file TrackClusterRemover.cc.

174 {
175 }

Member Function Documentation

template<typename T >
std::auto_ptr<edmNew::DetSetVector<T> > TrackClusterRemover::cleanup ( const edmNew::DetSetVector< T > &  oldClusters,
const std::vector< uint8_t > &  isGood,
reco::ClusterRemovalInfo::Indices refs,
const reco::ClusterRemovalInfo::Indices oldRefs 
)
private

Referenced by produce().

template<typename T >
auto_ptr<edmNew::DetSetVector<T> > TrackClusterRemover::cleanup ( const edmNew::DetSetVector< T > &  oldClusters,
const std::vector< uint8_t > &  isGood,
reco::ClusterRemovalInfo::Indices refs,
const reco::ClusterRemovalInfo::Indices oldRefs 
)

Definition at line 188 of file TrackClusterRemover.cc.

References edmNew::DetSetVector< T >::begin(), edmNew::DetSetVector< T >::data(), edmNew::DetSetVector< T >::dataSize(), edmNew::DetSetVector< T >::end(), getHLTprescales::index, mergeOld(), convertSQLitetoXML_cfg::output, and edmNew::DetSetVector< T >::size().

189  {
190  typedef typename edmNew::DetSetVector<T> DSV;
191  typedef typename edmNew::DetSetVector<T>::FastFiller DSF;
192  typedef typename edmNew::DetSet<T> DS;
193  auto_ptr<DSV> output(new DSV());
194  output->reserve(oldClusters.size(), oldClusters.dataSize());
195 
196  unsigned int countOld=0;
197  unsigned int countNew=0;
198 
199  // cluster removal loop
200  const T * firstOffset = & oldClusters.data().front();
201  for (typename DSV::const_iterator itdet = oldClusters.begin(), enddet = oldClusters.end(); itdet != enddet; ++itdet) {
202  DS oldDS = *itdet;
203 
204  if (oldDS.empty()) continue; // skip empty detsets
205 
206  uint32_t id = oldDS.detId();
207  DSF outds(*output, id);
208 
209  for (typename DS::const_iterator it = oldDS.begin(), ed = oldDS.end(); it != ed; ++it) {
210  uint32_t index = ((&*it) - firstOffset);
211  countOld++;
212  if (isGood[index]) {
213  outds.push_back(*it);
214  countNew++;
215  refs.push_back(index);
216  //std::cout << "TrackClusterRemover::cleanup " << typeid(T).name() << " reference " << index << " to " << (refs.size() - 1) << std::endl;
217  }
218 
219  }
220  if (outds.empty()) outds.abort(); // not write in an empty DSV
221  }
222 
223  if (oldRefs != 0) mergeOld(refs, *oldRefs);
224  return output;
225 }
const_iterator begin() const
size_type dataSize() const
data_type const * data(size_t cell) const
const_iterator end() const
void mergeOld(reco::ClusterRemovalInfo::Indices &refs, const reco::ClusterRemovalInfo::Indices &oldRefs)
size_type size() const
long double T
void TrackClusterRemover::mergeOld ( reco::ClusterRemovalInfo::Indices refs,
const reco::ClusterRemovalInfo::Indices oldRefs 
)
private

Definition at line 177 of file TrackClusterRemover.cc.

References i, and n.

Referenced by cleanup().

179 {
180  for (size_t i = 0, n = refs.size(); i < n; ++i) {
181  refs[i] = oldRefs[refs[i]];
182  }
183 }
int i
Definition: DBlmapReader.cc:9
void TrackClusterRemover::process ( const TrackingRecHit hit,
float  chi2 
)
inlineprivate

Definition at line 245 of file TrackClusterRemover.cc.

References SiPixelRecHit::cluster(), clusterWasteSolution_, collectedPixels_, cond::rpcobgas::detid, doPixel_, doStrip_, edm::hlt::Exception, TrackingRecHit::geographicalId(), edm::Ref< C, T, F >::id(), edm::Ref< C, T, F >::key(), TrackClusterRemover::ParamBlock::maxSize_, SiStripMatchedRecHit2D::monoClusterRef(), NumberOfParamBlocks, TrackerSingleRecHit::omniClusterRef(), ProjectedSiStripRecHit2D::originalHit(), pblocks_, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, pixels, pixelSourceProdID, DetId::rawId(), SiStripMatchedRecHit2D::stereoClusterRef(), and DetId::subdetId().

Referenced by ConfigBuilder.ConfigBuilder.PrintAllModules::leave(), and produce().

245  {
246  DetId detid = hit->geographicalId();
247  uint32_t subdet = detid.subdetId();
248 
249  assert ((subdet > 0) && (subdet <= NumberOfParamBlocks));
250 
251  // chi2 cut
252  if (chi2 > pblocks_[subdet-1].maxChi2_) return;
253 
254  if ((subdet == PixelSubdetector::PixelBarrel) || (subdet == PixelSubdetector::PixelEndcap)) {
255  if (!doPixel_) return;
256  // this is a pixel, and i *know* it is
257  const SiPixelRecHit *pixelHit = static_cast<const SiPixelRecHit *>(hit);
258 
259  SiPixelRecHit::ClusterRef cluster = pixelHit->cluster();
260 
261  if (cluster.id() != pixelSourceProdID) throw cms::Exception("Inconsistent Data") <<
262  "TrackClusterRemover: pixel cluster ref from Product ID = " << cluster.id() <<
263  " does not match with source cluster collection (ID = " << pixelSourceProdID << ")\n.";
264 
265  assert(cluster.id() == pixelSourceProdID);
266 //DBG// cout << "HIT NEW PIXEL DETID = " << detid.rawId() << ", Cluster [ " << cluster.key().first << " / " << cluster.key().second << " ] " << endl;
267 
268  // if requested, cut on cluster size
269  if (pblocks_[subdet-1].usesSize_ && (cluster->pixels().size() > pblocks_[subdet-1].maxSize_)) return;
270 
271  // mark as used
272  pixels[cluster.key()] = false;
273 
274  //if(!clusterWasteSolution_) collectedPixel[detid.rawId()].insert(cluster);
275  assert(collectedPixels_.size() > cluster.key());
276  //assert(detid.rawId() == cluster->geographicalId()); //This condition fails
277  if(!clusterWasteSolution_) collectedPixels_[cluster.key()]=true;
278 
279  } else { // aka Strip
280  if (!doStrip_) return;
281  const type_info &hitType = typeid(*hit);
282  if (hitType == typeid(SiStripRecHit2D)) {
283  const SiStripRecHit2D *stripHit = static_cast<const SiStripRecHit2D *>(hit);
284 //DBG// cout << "Plain RecHit 2D: " << endl;
285  process(stripHit->omniClusterRef(),subdet);}
286  else if (hitType == typeid(SiStripRecHit1D)) {
287  const SiStripRecHit1D *hit1D = static_cast<const SiStripRecHit1D *>(hit);
288  process(hit1D->omniClusterRef(),subdet);
289  } else if (hitType == typeid(SiStripMatchedRecHit2D)) {
290  const SiStripMatchedRecHit2D *matchHit = static_cast<const SiStripMatchedRecHit2D *>(hit);
291 //DBG// cout << "Matched RecHit 2D: " << endl;
292  process(matchHit->monoClusterRef(),subdet);
293  process(matchHit->stereoClusterRef(),subdet);
294  } else if (hitType == typeid(ProjectedSiStripRecHit2D)) {
295  const ProjectedSiStripRecHit2D *projHit = static_cast<const ProjectedSiStripRecHit2D *>(hit);
296 //DBG// cout << "Projected RecHit 2D: " << endl;
297  process(projHit->originalHit().omniClusterRef(),subdet);
298  } else throw cms::Exception("NOT IMPLEMENTED") << "Don't know how to handle " << hitType.name() << " on detid " << detid.rawId() << "\n";
299  }
300 }
static const unsigned int NumberOfParamBlocks
ParamBlock pblocks_[NumberOfParamBlocks]
OmniClusterRef const & stereoClusterRef() const
void process(const TrackingRecHit *hit, float chi2)
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
std::vector< uint8_t > pixels
OmniClusterRef const & monoClusterRef() const
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
Definition: DetId.h:20
OmniClusterRef const & omniClusterRef() const
ClusterRef cluster() const
Definition: SiPixelRecHit.h:41
key_type key() const
Accessor for product key.
Definition: Ref.h:266
edm::ProductID pixelSourceProdID
ProductID id() const
Accessor for product ID.
Definition: Ref.h:256
DetId geographicalId() const
const SiStripRecHit2D & originalHit() const
std::vector< bool > collectedPixels_
Our base class.
Definition: SiPixelRecHit.h:22
void TrackClusterRemover::process ( const OmniClusterRef cluRef,
uint32_t  subdet 
)
inlineprivate

Definition at line 228 of file TrackClusterRemover.cc.

References OmniClusterRef::cluster_strip(), clusterWasteSolution_, collectedStrips_, edm::Ref< C, T, F >::id(), edm::Ref< C, T, F >::key(), TrackClusterRemover::ParamBlock::maxSize_, pblocks_, strips, and stripSourceProdID.

Referenced by ConfigBuilder.ConfigBuilder.PrintAllModules::leave().

228  {
229  SiStripRecHit2D::ClusterRef cluster = ocluster.cluster_strip();
230  if (cluster.id() != stripSourceProdID) throw cms::Exception("Inconsistent Data") <<
231  "TrackClusterRemover: strip cluster ref from Product ID = " << cluster.id() <<
232  " does not match with source cluster collection (ID = " << stripSourceProdID << ")\n.";
233 
234  assert(cluster.id() == stripSourceProdID);
235  if (pblocks_[subdet-1].usesSize_ && (cluster->amplitudes().size() > pblocks_[subdet-1].maxSize_)) return;
236 
237  strips[cluster.key()] = false;
238  //if (!clusterWasteSolution_) collectedStrip[hit->geographicalId()].insert(cluster);
239  assert(collectedStrips_.size() > cluster.key());
240  //assert(hit->geographicalId() == cluster->geographicalId()); //This condition fails
241  if (!clusterWasteSolution_) collectedStrips_[cluster.key()]=true;
242 }
ParamBlock pblocks_[NumberOfParamBlocks]
edm::ProductID stripSourceProdID
std::vector< uint8_t > strips
key_type key() const
Accessor for product key.
Definition: Ref.h:266
std::vector< bool > collectedStrips_
ProductID id() const
Accessor for product ID.
Definition: Ref.h:256
void TrackClusterRemover::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDProducer.

Definition at line 314 of file TrackClusterRemover.cc.

References cleanup(), clusterWasteSolution_, collectedPixels_, collectedStrips_, prof2calltree::count, doPixel_, doStrip_, edm::InputTag::encode(), edm::hlt::Exception, lumiContext::fill, filterTracks_, edm::Event::getByLabel(), reco::TrackBase::hitPattern(), edm::HandleBase::id(), TrackingRecHit::isValid(), edm::helpers::KeyVal< K, V >::key, LogDebug, Trajectory::measurements(), mergeOld_, minNumberOfLayersWithMeasBeforeFiltering_, oldRemovalInfo_, overrideTrkQuals_, clustersummaryproducer_cfg::pixelClusters, pixelClusters_, pixels, pixelSourceProdID, process(), edm::Event::put(), reco::TrackBase::quality(), edm::ProductID::reset(), clustersummaryproducer_cfg::stripClusters, stripClusters_, strips, stripSourceProdID, reco::HitPattern::trackerLayersWithMeasurement(), trackQuality_, trajectories_, and edm::helpers::KeyVal< K, V >::val.

315 {
316  ProductID pixelOldProdID, stripOldProdID;
317 
319  if (doPixel_) {
320  iEvent.getByLabel(pixelClusters_, pixelClusters);
321  pixelSourceProdID = pixelClusters.id();
322  }
323 //DBG// std::cout << "TrackClusterRemover: Read pixel " << pixelClusters_.encode() << " = ID " << pixelSourceProdID << std::endl;
324 
326  if (doStrip_) {
327  iEvent.getByLabel(stripClusters_, stripClusters);
328  stripSourceProdID = stripClusters.id();
329  }
330 //DBG// std::cout << "TrackClusterRemover: Read strip " << stripClusters_.encode() << " = ID " << stripSourceProdID << std::endl;
331 
332  auto_ptr<ClusterRemovalInfo> cri;
334  if (doStrip_ && doPixel_) cri.reset(new ClusterRemovalInfo(pixelClusters, stripClusters));
335  else if (doStrip_) cri.reset(new ClusterRemovalInfo(stripClusters));
336  else if (doPixel_) cri.reset(new ClusterRemovalInfo(pixelClusters));
337  }
338 
339  Handle<ClusterRemovalInfo> oldRemovalInfo;
341  iEvent.getByLabel(oldRemovalInfo_, oldRemovalInfo);
342  // Check ProductIDs
343  if ( (oldRemovalInfo->stripNewRefProd().id() == stripClusters.id()) &&
344  (oldRemovalInfo->pixelNewRefProd().id() == pixelClusters.id()) ) {
345 
346  cri->getOldClustersFrom(*oldRemovalInfo);
347 
348  pixelOldProdID = oldRemovalInfo->pixelRefProd().id();
349  stripOldProdID = oldRemovalInfo->stripRefProd().id();
350 
351  } else {
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";
357  }
358  } else { // then Old == Source
359  pixelOldProdID = pixelSourceProdID;
360  stripOldProdID = stripSourceProdID;
361  }
362 
363  Handle<TrajTrackAssociationCollection> trajectories_totrack;
364  iEvent.getByLabel(trajectories_,trajectories_totrack);
365 
366  std::vector<Handle<edm::ValueMap<int> > > quals;
367  if ( overrideTrkQuals_.size() > 0) {
368  quals.resize(1);
369  iEvent.getByLabel(overrideTrkQuals_[0],quals[0]);
370  }
371 
372  if (doStrip_) {
373  strips.resize(stripClusters->dataSize()); fill(strips.begin(), strips.end(), true);
374  }
375  if (doPixel_) {
376  pixels.resize(pixelClusters->dataSize()); fill(pixels.begin(), pixels.end(), true);
377  }
378  typedef edm::ContainerMask<edmNew::DetSetVector<SiPixelCluster> > PixelMaskContainer;
379  typedef edm::ContainerMask<edmNew::DetSetVector<SiStripCluster> > StripMaskContainer;
380  if(mergeOld_) {
383  iEvent.getByLabel(oldRemovalInfo_,oldPxlMask);
384  iEvent.getByLabel(oldRemovalInfo_,oldStrMask);
385  LogDebug("TrackClusterRemover")<<"to merge in, "<<oldStrMask->size()<<" strp and "<<oldPxlMask->size()<<" pxl";
386  oldStrMask->copyMaskTo(collectedStrips_);
387  oldPxlMask->copyMaskTo(collectedPixels_);
388  }else {
389  collectedStrips_.resize(stripClusters->dataSize()); fill(collectedStrips_.begin(), collectedStrips_.end(), false);
390  collectedPixels_.resize(pixelClusters->dataSize()); fill(collectedPixels_.begin(), collectedPixels_.end(), false);
391  }
392  TrajTrackAssociationCollection::const_iterator asst=trajectories_totrack->begin();
393 
394  for ( ; asst!=trajectories_totrack->end();++asst){
395  const Track & track = *(asst->val);
396  if (filterTracks_) {
397  bool goodTk = true;
398  if ( quals.size()!=0) {
399  int qual=(*(quals[0]))[asst->val];
400  if ( qual < 0 ) {goodTk=false;}
401  //note that this does not work for some trackquals (goodIterative or undefQuality)
402  else
403  goodTk = ( qual & (1<<trackQuality_))>>trackQuality_;
404  }
405  else
406  goodTk=(track.quality(trackQuality_));
407  if ( !goodTk) continue;
409  }
410  const Trajectory &tj = *(asst->key);
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) {
414  const TrackingRecHit *hit = itm->recHit()->hit();
415  if (!hit->isValid()) continue;
416  process( hit, itm->estimate() );
417  }
418  }
419 
420 
422  auto_ptr<edmNew::DetSetVector<SiPixelCluster> > newPixelClusters = cleanup(*pixelClusters, pixels,
423  cri->pixelIndices(), mergeOld_ ? &oldRemovalInfo->pixelIndices() : 0);
424  OrphanHandle<edmNew::DetSetVector<SiPixelCluster> > newPixels = iEvent.put(newPixelClusters);
425 //DBG// std::cout << "TrackClusterRemover: Wrote pixel " << newPixels.id() << " from " << pixelSourceProdID << std::endl;
426  cri->setNewPixelClusters(newPixels);
427  }
429  auto_ptr<edmNew::DetSetVector<SiStripCluster> > newStripClusters = cleanup(*stripClusters, strips,
430  cri->stripIndices(), mergeOld_ ? &oldRemovalInfo->stripIndices() : 0);
431  OrphanHandle<edmNew::DetSetVector<SiStripCluster> > newStrips = iEvent.put(newStripClusters);
432 //DBG// std::cout << "TrackClusterRemover: Wrote strip " << newStrips.id() << " from " << stripSourceProdID << std::endl;
433  cri->setNewStripClusters(newStrips);
434  }
435 
436 
437  if (clusterWasteSolution_) {
438  // double fraction_pxl= cri->pixelIndices().size() / (double) pixels.size();
439  // double fraction_strp= cri->stripIndices().size() / (double) strips.size();
440  // edm::LogWarning("TrackClusterRemover")<<" fraction: " << fraction_pxl <<" "<<fraction_strp;
441  iEvent.put(cri);
442  }
443 
444  pixels.clear(); strips.clear();
445 
446  if (!clusterWasteSolution_){
447  //auto_ptr<edmNew::DetSetVector<SiPixelClusterRefNew> > removedPixelClsuterRefs(new edmNew::DetSetVector<SiPixelClusterRefNew>());
448  //auto_ptr<edmNew::DetSetVector<SiStripRecHit1D::ClusterRef> > removedStripClsuterRefs(new edmNew::DetSetVector<SiStripRecHit1D::ClusterRef>());
449 
450  std::auto_ptr<StripMaskContainer> removedStripClusterMask(
451  new StripMaskContainer(edm::RefProd<edmNew::DetSetVector<SiStripCluster> >(stripClusters),collectedStrips_));
452  LogDebug("TrackClusterRemover")<<"total strip to skip: "<<std::count(collectedStrips_.begin(),collectedStrips_.end(),true);
453  iEvent.put( removedStripClusterMask );
454 
455  std::auto_ptr<PixelMaskContainer> removedPixelClusterMask(
456  new PixelMaskContainer(edm::RefProd<edmNew::DetSetVector<SiPixelCluster> >(pixelClusters),collectedPixels_));
457  LogDebug("TrackClusterRemover")<<"total pxl to skip: "<<std::count(collectedPixels_.begin(),collectedPixels_.end(),true);
458  iEvent.put( removedPixelClusterMask );
459 
460  }
461 
462 
463 }
#define LogDebug(id)
edm::InputTag stripClusters_
string fill
Definition: lumiContext.py:319
edm::InputTag pixelClusters_
ProductID id() const
Definition: HandleBase.cc:15
void process(const TrackingRecHit *hit, float chi2)
reco::TrackBase::TrackQuality trackQuality_
std::string encode() const
Definition: InputTag.cc:72
edm::InputTag oldRemovalInfo_
DataContainer const & measurements() const
Definition: Trajectory.h:203
edm::ProductID stripSourceProdID
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
int trackerLayersWithMeasurement() const
Definition: HitPattern.h:705
std::vector< uint8_t > pixels
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
Definition: TrackBase.h:223
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
void reset()
Definition: ProductID.h:39
std::vector< uint8_t > strips
std::vector< bool > collectedStrips_
bool isValid() const
bool quality(const TrackQuality) const
Track quality.
Definition: TrackBase.h:377
std::vector< edm::InputTag > overrideTrkQuals_
edm::ProductID pixelSourceProdID
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)
void TrackClusterRemover::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 
)
private

Definition at line 96 of file TrackClusterRemover.cc.

References edm::ParameterSet::exists(), lumiContext::fill, and edm::ParameterSet::getParameter().

Referenced by TrackClusterRemover().

98 {
99  if (iConfig.exists(name)) {
100  ParamBlock pblock(iConfig.getParameter<ParameterSet>(name));
101  if (id1 == -1) {
103  } else {
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;
110  }
111  }
112 }
T getParameter(std::string const &) const
string fill
Definition: lumiContext.py:319
static const unsigned int NumberOfParamBlocks
ParamBlock pblocks_[NumberOfParamBlocks]
bool exists(std::string const &parameterName) const
checks if a parameter exists

Member Data Documentation

bool TrackClusterRemover::clusterWasteSolution_
private

Definition at line 82 of file TrackClusterRemover.cc.

Referenced by process(), produce(), and TrackClusterRemover().

std::vector<bool> TrackClusterRemover::collectedPixels_
private

Definition at line 87 of file TrackClusterRemover.cc.

Referenced by process(), and produce().

std::vector<bool> TrackClusterRemover::collectedStrips_
private

Definition at line 86 of file TrackClusterRemover.cc.

Referenced by process(), and produce().

bool TrackClusterRemover::doPixel_
private

Definition at line 58 of file TrackClusterRemover.cc.

Referenced by process(), produce(), and TrackClusterRemover().

bool TrackClusterRemover::doStrip_
private

Definition at line 58 of file TrackClusterRemover.cc.

Referenced by process(), produce(), and TrackClusterRemover().

bool TrackClusterRemover::filterTracks_
private

Definition at line 83 of file TrackClusterRemover.cc.

Referenced by produce(), and TrackClusterRemover().

bool TrackClusterRemover::mergeOld_
private

Definition at line 60 of file TrackClusterRemover.cc.

Referenced by produce().

int TrackClusterRemover::minNumberOfLayersWithMeasBeforeFiltering_
private

Definition at line 84 of file TrackClusterRemover.cc.

Referenced by produce(), and TrackClusterRemover().

const unsigned int TrackClusterRemover::NumberOfParamBlocks = 6
staticprivate

Definition at line 54 of file TrackClusterRemover.cc.

Referenced by process(), and TrackClusterRemover().

edm::InputTag TrackClusterRemover::oldRemovalInfo_
private

Definition at line 61 of file TrackClusterRemover.cc.

Referenced by produce().

std::vector<edm::InputTag> TrackClusterRemover::overrideTrkQuals_
private

Definition at line 57 of file TrackClusterRemover.cc.

Referenced by produce(), and TrackClusterRemover().

ParamBlock TrackClusterRemover::pblocks_[NumberOfParamBlocks]
private

Definition at line 63 of file TrackClusterRemover.cc.

Referenced by process(), and TrackClusterRemover().

edm::InputTag TrackClusterRemover::pixelClusters_
private

Definition at line 59 of file TrackClusterRemover.cc.

Referenced by produce().

std::vector<uint8_t> TrackClusterRemover::pixels
private

Definition at line 67 of file TrackClusterRemover.cc.

Referenced by process(), and produce().

edm::ProductID TrackClusterRemover::pixelSourceProdID
private

Definition at line 68 of file TrackClusterRemover.cc.

Referenced by process(), and produce().

edm::InputTag TrackClusterRemover::stripClusters_
private

Definition at line 59 of file TrackClusterRemover.cc.

Referenced by produce().

std::vector<uint8_t> TrackClusterRemover::strips
private

Definition at line 67 of file TrackClusterRemover.cc.

Referenced by process(), and produce().

edm::ProductID TrackClusterRemover::stripSourceProdID
private

Definition at line 68 of file TrackClusterRemover.cc.

Referenced by process(), and produce().

reco::TrackBase::TrackQuality TrackClusterRemover::trackQuality_
private

Definition at line 85 of file TrackClusterRemover.cc.

Referenced by produce(), and TrackClusterRemover().

edm::InputTag TrackClusterRemover::trajectories_
private

Definition at line 56 of file TrackClusterRemover.cc.

Referenced by produce().