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 Types | Private Member Functions | Private Attributes | Static Private Attributes
HLTTrackClusterRemoverNew Class Referencefinal
Inheritance diagram for HLTTrackClusterRemoverNew:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase 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)
 
 HLTTrackClusterRemoverNew (const edm::ParameterSet &iConfig)
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 ~HLTTrackClusterRemoverNew ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Types

typedef edm::ContainerMask
< edmNew::DetSetVector
< SiPixelCluster > > 
PixelMaskContainer
 
typedef edm::ContainerMask
< edmNew::DetSetVector
< SiStripCluster > > 
StripMaskContainer
 

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

std::vector< bool > collectedPixels_
 
std::vector< bool > collectedRegStrips_
 
bool doPixel_
 
bool doPixelChargeCheck_
 
bool doStrip_
 
bool doStripChargeCheck_
 
bool doTracks_
 
bool makeProducts_
 
bool mergeOld_
 
edm::EDGetTokenT
< PixelMaskContainer
oldPxlMaskToken_
 
edm::EDGetTokenT
< StripMaskContainer
oldStrMaskToken_
 
ParamBlock pblocks_ [NumberOfParamBlocks]
 
edm::EDGetTokenT
< edmNew::DetSetVector
< SiPixelCluster > > 
pixelClusters_
 
std::vector< uint8_t > pixels
 
edm::ProductID pixelSourceProdID
 
edm::EDGetTokenT
< edmNew::DetSetVector
< SiStripCluster > > 
stripClusters_
 
std::vector< uint8_t > strips
 
edm::ProductID stripSourceProdID
 
edm::EDGetTokenT< std::vector
< Trajectory > > 
trajectories_
 

Static Private Attributes

static const unsigned int NumberOfParamBlocks = 6
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- 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::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 34 of file HLTTrackClusterRemoverNew.cc.

Member Typedef Documentation

Definition at line 63 of file HLTTrackClusterRemoverNew.cc.

Definition at line 64 of file HLTTrackClusterRemoverNew.cc.

Constructor & Destructor Documentation

HLTTrackClusterRemoverNew::HLTTrackClusterRemoverNew ( const edm::ParameterSet iConfig)

Definition at line 121 of file HLTTrackClusterRemoverNew.cc.

References doPixel_, doPixelChargeCheck_, doStrip_, doStripChargeCheck_, doTracks_, edm::hlt::Exception, edm::ParameterSet::exists(), lumiContext::fill, edm::ParameterSet::getParameter(), i, mergeOld_, NumberOfParamBlocks, oldPxlMaskToken_, oldStrMaskToken_, pblocks_, pixelClusters_, readPSet(), stripClusters_, and trajectories_.

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)
125  , mergeOld_(false)
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)
129 
130 {
131 
132  if (iConfig.exists("oldClusterRemovalInfo"))
133  {
134  oldPxlMaskToken_ = consumes<PixelMaskContainer>(iConfig.getParameter<InputTag>("oldClusterRemovalInfo"));
135  oldStrMaskToken_ = consumes<StripMaskContainer>(iConfig.getParameter<InputTag>("oldClusterRemovalInfo"));
136  if (not (iConfig.getParameter<InputTag>("oldClusterRemovalInfo")== edm::InputTag())) mergeOld_=true;
137  }
138 
140  throw cms::Exception("Configuration Error") << "HLTTrackClusterRemoverNew: Charge check asked without cluster collection ";
142  throw cms::Exception("Configuration Error") << "HLTTrackClusterRemoverNew: Pixel cluster charge check not yet implemented";
143 
144  fill(pblocks_, pblocks_+NumberOfParamBlocks, ParamBlock());
145  readPSet(iConfig, "Common",-1);
146  if (doPixel_) {
147  readPSet(iConfig, "Pixel" , 0,1);
148  readPSet(iConfig, "PXB" , 0);
149  readPSet(iConfig, "PXE" , 1);
150  }
151  if (doStrip_) {
152  readPSet(iConfig, "Strip" , 2,3,4,5);
153  readPSet(iConfig, "StripInner" ,2,3);
154  readPSet(iConfig, "StripOuter" ,4,5);
155  readPSet(iConfig, "TIB" , 2);
156  readPSet(iConfig, "TID" , 3);
157  readPSet(iConfig, "TOB" , 4);
158  readPSet(iConfig, "TEC" , 5);
159  }
160 
161  bool usingCharge = false;
162  for (size_t i = 0; i < NumberOfParamBlocks; ++i) {
163  if (!pblocks_[i].isSet_) throw cms::Exception("Configuration Error") << "HLTTrackClusterRemoverNew: Missing configuration for detector with subDetID = " << (i+1);
164  if (pblocks_[i].usesCharge_ && !usingCharge) {
165  throw cms::Exception("Configuration Error") << "HLTTrackClusterRemoverNew: Configuration for subDetID = " << (i+1) << " uses cluster charge, which is not enabled.";
166  }
167  }
168 
169  // trajectories_ = consumes<vector<Trajectory> >(iConfig.getParameter<InputTag>("trajectories"));
170  if (doTracks_) trajectories_ = consumes<vector<Trajectory> > (iConfig.getParameter<InputTag>("trajectories") );
171  if (doPixel_) pixelClusters_ = consumes<edmNew::DetSetVector<SiPixelCluster> >(iConfig.getParameter<InputTag>("pixelClusters"));
172  if (doStrip_) stripClusters_ = consumes<edmNew::DetSetVector<SiStripCluster> > (iConfig.getParameter<InputTag>("stripClusters"));
173  if (mergeOld_) {
174  oldPxlMaskToken_ = consumes<PixelMaskContainer>(iConfig.getParameter<InputTag>("oldClusterRemovalInfo"));
175  oldStrMaskToken_ = consumes<StripMaskContainer>(iConfig.getParameter<InputTag>("oldClusterRemovalInfo"));
176  }
177 
178  //produces<edmNew::DetSetVector<SiPixelClusterRefNew> >();
179  //produces<edmNew::DetSetVector<SiStripRecHit1D::ClusterRegionalRef> >();
180 
181  produces< edm::ContainerMask<edmNew::DetSetVector<SiPixelCluster> > >();
182  produces< edm::ContainerMask<edmNew::DetSetVector<SiStripCluster> > >();
183 
184 }
T getParameter(std::string const &) const
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > stripClusters_
int i
Definition: DBlmapReader.cc:9
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:184
static const unsigned int NumberOfParamBlocks
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelClusters_
bool exists(std::string const &parameterName) const
checks if a parameter exists
edm::EDGetTokenT< PixelMaskContainer > oldPxlMaskToken_
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)
ParamBlock pblocks_[NumberOfParamBlocks]
edm::EDGetTokenT< std::vector< Trajectory > > trajectories_
edm::EDGetTokenT< StripMaskContainer > oldStrMaskToken_
HLTTrackClusterRemoverNew::~HLTTrackClusterRemoverNew ( )

Definition at line 187 of file HLTTrackClusterRemoverNew.cc.

188 {
189 }

Member Function Documentation

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

Definition at line 202 of file HLTTrackClusterRemoverNew.cc.

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

203  {
204  typedef typename edmNew::DetSetVector<T> DSV;
205  typedef typename edmNew::DetSetVector<T>::FastFiller DSF;
206  typedef typename edmNew::DetSet<T> DS;
207  auto_ptr<DSV> output(new DSV());
208  output->reserve(oldClusters.size(), oldClusters.dataSize());
209 
210  unsigned int countOld=0;
211  unsigned int countNew=0;
212 
213  // cluster removal loop
214  const T * firstOffset = & oldClusters.data().front();
215  for (typename DSV::const_iterator itdet = oldClusters.begin(), enddet = oldClusters.end(); itdet != enddet; ++itdet) {
216  DS oldDS = *itdet;
217 
218  if (oldDS.empty()) continue; // skip empty detsets
219 
220  uint32_t id = oldDS.detId();
221  DSF outds(*output, id);
222 
223  for (typename DS::const_iterator it = oldDS.begin(), ed = oldDS.end(); it != ed; ++it) {
224  uint32_t index = ((&*it) - firstOffset);
225  countOld++;
226  if (isGood[index]) {
227  outds.push_back(*it);
228  countNew++;
229  refs.push_back(index);
230  //std::cout << "HLTTrackClusterRemoverNew::cleanup " << typeid(T).name() << " reference " << index << " to " << (refs.size() - 1) << std::endl;
231  }
232 
233  }
234  if (outds.empty()) outds.abort(); // not write in an empty DSV
235  }
236  // double fraction = countNew / (double) countOld;
237  // std::cout<<"fraction: "<<fraction<<std::endl;
238  if (oldRefs != 0) mergeOld(refs, *oldRefs);
239  return output;
240 }
const_iterator end(bool update=false) const
size_type dataSize() const
data_type const * data(size_t cell) const
void mergeOld(reco::ClusterRemovalInfo::Indices &refs, const reco::ClusterRemovalInfo::Indices &oldRefs)
size_type size() const
long double T
const_iterator begin(bool update=false) const
void HLTTrackClusterRemoverNew::mergeOld ( reco::ClusterRemovalInfo::Indices refs,
const reco::ClusterRemovalInfo::Indices oldRefs 
)
private

Definition at line 191 of file HLTTrackClusterRemoverNew.cc.

References i, and n.

Referenced by cleanup().

193 {
194  for (size_t i = 0, n = refs.size(); i < n; ++i) {
195  refs[i] = oldRefs[refs[i]];
196  }
197 }
int i
Definition: DBlmapReader.cc:9
void HLTTrackClusterRemoverNew::process ( const TrackingRecHit hit,
float  chi2 
)
inlineprivate

Definition at line 258 of file HLTTrackClusterRemoverNew.cc.

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

Referenced by ConfigBuilder.ConfigBuilder::addExtraStream(), ConfigBuilder.ConfigBuilder::completeInputCommand(), ConfigBuilder.ConfigBuilder::doNotInlineEventContent(), ConfigBuilder.ConfigBuilder.PrintAllModules::leave(), ConfigBuilder.ConfigBuilder::prepare_FASTSIM(), ConfigBuilder.ConfigBuilder::prepare_HLT(), ConfigBuilder.ConfigBuilder::prepare_LHE(), ConfigBuilder.ConfigBuilder::prepare_VALIDATION(), produce(), ConfigBuilder.ConfigBuilder::renameHLTprocessInSequence(), ConfigBuilder.ConfigBuilder::renameInputTagsInSequence(), and ConfigBuilder.ConfigBuilder::scheduleSequence().

258  {
259  DetId detid = hit->geographicalId();
260  uint32_t subdet = detid.subdetId();
261 
262 
263  assert ((subdet > 0) && (subdet <= NumberOfParamBlocks));
264 
265  // chi2 cut
266  if (chi2 > pblocks_[subdet-1].maxChi2_) return;
267 
268  if ((subdet == PixelSubdetector::PixelBarrel) || (subdet == PixelSubdetector::PixelEndcap)) {
269  // std::cout<<"process pxl hit"<<std::endl;
270  if (!doPixel_) return;
271  // this is a pixel, and i *know* it is
272  const SiPixelRecHit *pixelHit = static_cast<const SiPixelRecHit *>(hit);
273 
274  SiPixelRecHit::ClusterRef cluster = pixelHit->cluster();
275  if (cluster.id() != pixelSourceProdID) throw cms::Exception("Inconsistent Data") <<
276  "HLTTrackClusterRemoverNew: pixel cluster ref from Product ID = " << cluster.id() <<
277  " does not match with source cluster collection (ID = " << pixelSourceProdID << ")\n.";
278 
279  assert(cluster.id() == pixelSourceProdID);
280  //DBG// cout << "HIT NEW PIXEL DETID = " << detid.rawId() << ", Cluster [ " << cluster.key().first << " / " << cluster.key().second << " ] " << endl;
281 
282  // if requested, cut on cluster size
283  if (pblocks_[subdet-1].usesSize_ && (cluster->pixels().size() > pblocks_[subdet-1].maxSize_)) return;
284 
285  // mark as used
286  //pixels[cluster.key()] = false;
287  assert(collectedPixels_.size() > cluster.key());
288  collectedPixels_[cluster.key()]=true;
289  } else { // aka Strip
290  if (!doStrip_) return;
291  const type_info &hitType = typeid(*hit);
292  if (hitType == typeid(SiStripRecHit2D)) {
293  const SiStripRecHit2D *stripHit = static_cast<const SiStripRecHit2D *>(hit);
294  //DBG// cout << "Plain RecHit 2D: " << endl;
295  process(stripHit->omniClusterRef(),subdet);
296  // int clusCharge=0;
297  // for ( auto cAmp : stripHit->omniClusterRef().stripCluster().amplitudes() ) clusCharge+=cAmp;
298  // std::cout << "[HLTTrackClusterRemoverNew::process (SiStripRecHit2D) chi2: " << chi2 << " [" << subdet << " --> charge: " << clusCharge << "]" << std::endl;
299  } else if (hitType == typeid(SiStripRecHit1D)) {
300  const SiStripRecHit1D *hit1D = static_cast<const SiStripRecHit1D *>(hit);
301  process(hit1D->omniClusterRef(),subdet);
302  // int clusCharge=0;
303  // for ( auto cAmp : hit1D->omniClusterRef().stripCluster().amplitudes() ) clusCharge+=cAmp;
304  // std::cout << "[HLTTrackClusterRemoverNew::process (SiStripRecHit1D) chi2: " << chi2 << " [" << subdet << " --> charge: " << clusCharge << "]" << std::endl;
305  } else if (hitType == typeid(SiStripMatchedRecHit2D)) {
306  const SiStripMatchedRecHit2D *matchHit = static_cast<const SiStripMatchedRecHit2D *>(hit);
307  //DBG// cout << "Matched RecHit 2D: " << endl;
308  process(matchHit->monoClusterRef(), subdet);
309  // int clusCharge=0;
310  // for ( auto cAmp : matchHit->monoClusterRef().stripCluster().amplitudes() ) clusCharge+=cAmp;
311  // std::cout << "[HLTTrackClusterRemoverNew::process (SiStripMatchedRecHit2D:mono) chi2: " << chi2 << " [" << subdet << " --> charge: " << clusCharge << "]" << std::endl;
312 
313  process(matchHit->stereoClusterRef(),subdet);
314  // clusCharge=0;
315  // for ( auto cAmp : matchHit->stereoClusterRef().stripCluster().amplitudes() ) clusCharge+=cAmp;
316  // std::cout << "[HLTTrackClusterRemoverNew::process (SiStripMatchedRecHit2D:stereo) chi2: " << chi2 << " [" << subdet << " --> charge: " << clusCharge << "]" << std::endl;
317 
318  } else if (hitType == typeid(ProjectedSiStripRecHit2D)) {
319  const ProjectedSiStripRecHit2D *projHit = static_cast<const ProjectedSiStripRecHit2D *>(hit);
320  //DBG// cout << "Projected RecHit 2D: " << endl;
321  process(projHit->originalHit().omniClusterRef(),subdet);
322  // int clusCharge=0;
323  // for ( auto cAmp : projHit->originalHit().omniClusterRef().stripCluster().amplitudes() ) clusCharge+=cAmp;
324  // std::cout << "[HLTTrackClusterRemoverNew::process (ProjectedSiStripRecHit2D) chi2: " << chi2 << " [" << subdet << " --> charge: " << clusCharge << "]" << std::endl;
325  } else throw cms::Exception("NOT IMPLEMENTED") << "Don't know how to handle " << hitType.name() << " on detid " << detid.rawId() << "\n";
326  }
327 }
static const unsigned int NumberOfParamBlocks
OmniClusterRef const & stereoClusterRef() const
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
ParamBlock pblocks_[NumberOfParamBlocks]
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:37
SiStripRecHit2D originalHit() const
Definition: DetId.h:18
OmniClusterRef const & omniClusterRef() const
ClusterRef cluster() const
Definition: SiPixelRecHit.h:49
key_type key() const
Accessor for product key.
Definition: Ref.h:266
void process(const TrackingRecHit *hit, float chi2)
ProductID id() const
Accessor for product ID.
Definition: Ref.h:256
DetId geographicalId() const
Our base class.
Definition: SiPixelRecHit.h:23
void HLTTrackClusterRemoverNew::process ( const OmniClusterRef cluRef,
uint32_t  subdet 
)
inlineprivate

Definition at line 242 of file HLTTrackClusterRemoverNew.cc.

References collectedRegStrips_, OmniClusterRef::id(), OmniClusterRef::key(), and stripSourceProdID.

Referenced by ConfigBuilder.ConfigBuilder::addExtraStream(), ConfigBuilder.ConfigBuilder::completeInputCommand(), ConfigBuilder.ConfigBuilder::doNotInlineEventContent(), ConfigBuilder.ConfigBuilder.PrintAllModules::leave(), ConfigBuilder.ConfigBuilder::prepare_FASTSIM(), ConfigBuilder.ConfigBuilder::prepare_HLT(), ConfigBuilder.ConfigBuilder::prepare_LHE(), ConfigBuilder.ConfigBuilder::prepare_VALIDATION(), ConfigBuilder.ConfigBuilder::renameHLTprocessInSequence(), ConfigBuilder.ConfigBuilder::renameInputTagsInSequence(), and ConfigBuilder.ConfigBuilder::scheduleSequence().

242  {
243 
244  if (clusterReg.id() != stripSourceProdID) throw cms::Exception("Inconsistent Data") <<
245  "HLTTrackClusterRemoverNew: strip cluster ref from Product ID = " << clusterReg.id() <<
246  " does not match with source cluster collection (ID = " << stripSourceProdID << ")\n.";
247 
248  if (collectedRegStrips_.size()<=clusterReg.key()){
249  edm::LogError("BadCollectionSize")<<collectedRegStrips_.size()<<" is smaller than "<<clusterReg.key();
250 
251  assert(collectedRegStrips_.size()>clusterReg.key());
252  }
253  collectedRegStrips_[clusterReg.key()]=true;
254 }
void HLTTrackClusterRemoverNew::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::EDProducer.

Definition at line 341 of file HLTTrackClusterRemoverNew.cc.

References collectedPixels_, collectedRegStrips_, prof2calltree::count, cond::rpcobgas::detid, doPixel_, doStrip_, doStripChargeCheck_, lumiContext::fill, edm::Event::getByToken(), i, edm::HandleBase::id(), TrackingRecHit::isValid(), LogDebug, Trajectory::measurements(), mergeOld_, oldPxlMaskToken_, oldStrMaskToken_, pblocks_, clustersummaryproducer_cfg::pixelClusters, pixelClusters_, pixelSourceProdID, process(), edm::Event::put(), clustersummaryproducer_cfg::stripClusters, stripClusters_, stripSourceProdID, DetId::subdetId(), and trajectories_.

342 {
343  ProductID pixelOldProdID, stripOldProdID;
344 
346  if (doPixel_) {
347  iEvent.getByToken(pixelClusters_, pixelClusters);
348  pixelSourceProdID = pixelClusters.id();
349  }
350 
352  if (doStrip_) {
353  iEvent.getByToken(stripClusters_, stripClusters);
354  stripSourceProdID = stripClusters.id();
355  }
356 
357  //Handle<TrajTrackAssociationCollection> trajectories;
358  edm::Handle<vector<Trajectory> > trajectories;
359  iEvent.getByToken(trajectories_, trajectories);
360 
361  if(mergeOld_) {
364  iEvent.getByToken(oldPxlMaskToken_ ,oldPxlMask);
365  iEvent.getByToken(oldStrMaskToken_ ,oldStrMask);
366  LogDebug("TrackClusterRemover")<<"to merge in, "<<oldStrMask->size()<<" strp and "<<oldPxlMask->size()<<" pxl";
367  oldStrMask->copyMaskTo(collectedRegStrips_);
368  oldPxlMask->copyMaskTo(collectedPixels_);
369  collectedRegStrips_.resize(stripClusters->dataSize());
370  }else {
371  collectedRegStrips_.resize(stripClusters->dataSize()); fill(collectedRegStrips_.begin(), collectedRegStrips_.end(), false);
372  collectedPixels_.resize(pixelClusters->dataSize()); fill(collectedPixels_.begin(), collectedPixels_.end(), false);
373  }
374 
375 
376  //for (TrajTrackAssociationCollection::const_iterator it = trajectories->begin(), ed = trajectories->end(); it != ed; ++it) {
377  // const Trajectory &tj = * it->key;
378 
379  for (std::vector<Trajectory>::const_iterator it = trajectories->begin(), ed = trajectories->end(); it != ed; ++it) {
380  const Trajectory &tj = * it;
381  const std::vector<TrajectoryMeasurement> &tms = tj.measurements();
382 
383  std::vector<TrajectoryMeasurement>::const_iterator itm, endtm;
384  for (itm = tms.begin(), endtm = tms.end(); itm != endtm; ++itm) {
385 
386  const TrackingRecHit *hit = itm->recHit()->hit();
387  if (!hit->isValid()) continue;
388  // std::cout<<"process hit"<<std::endl;
389  process( hit, itm->estimate() );
390  }
391  }
392 
393 
394  // std::cout << " => collectedRegStrips_: " << collectedRegStrips_.size() << std::endl;
395  // std::cout << " total strip to skip (before charge check): "<<std::count(collectedRegStrips_.begin(),collectedRegStrips_.end(),true) << std::endl;
396  if (doStripChargeCheck_) {
397  // std::cout << "[HLTTrackClusterRemoverNew::produce] doStripChargeCheck_: " << (doStripChargeCheck_ ? "true" : "false") << " stripClusters: " << stripClusters->size() << std::endl;
398 
399 
400  auto const & clusters = stripClusters->data();
401  for (auto const & item : stripClusters->ids()) {
402 
403  if (!item.isValid()) continue; // not umpacked
404 
405  DetId detid = item.id;
406  uint32_t subdet = detid.subdetId();
407  if (!pblocks_[subdet-1].cutOnStripCharge_) continue;
408 
409  // std::cout << " i: " << i << " --> detid: " << detid << " --> subdet: " << subdet << std::endl;
410 
411  for (auto i = item.offset; i<item.offset+int(item.size); ++i) {
412  int clusCharge=0;
413  for ( auto cAmp : clusters[i].amplitudes() ) clusCharge+=cAmp;
414 
415  // if (clusCharge < pblocks_[subdet-1].minGoodStripCharge_) std::cout << " clusCharge: " << clusCharge << std::endl;
416  if(clusCharge < pblocks_[subdet-1].minGoodStripCharge_) collectedRegStrips_[i] = true; // (|= does not work!)
417  }
418 
419  }
420  }
421 
422  // std::cout << " => collectedRegStrips_: " << collectedRegStrips_.size() << std::endl;
423  // std::cout << " total strip to skip: "<<std::count(collectedRegStrips_.begin(),collectedRegStrips_.end(),true) << std::endl;
424  std::auto_ptr<StripMaskContainer> removedStripClusterMask(
426  LogDebug("TrackClusterRemover")<<"total strip to skip: "<<std::count(collectedRegStrips_.begin(),collectedRegStrips_.end(),true);
427  // std::cout << "TrackClusterRemover" <<" total strip to skip: "<<std::count(collectedRegStrips_.begin(),collectedRegStrips_.end(),true)<<std::endl;
428  iEvent.put( removedStripClusterMask );
429 
430  std::auto_ptr<PixelMaskContainer> removedPixelClusterMask(
432  LogDebug("TrackClusterRemover")<<"total pxl to skip: "<<std::count(collectedPixels_.begin(),collectedPixels_.end(),true);
433  iEvent.put( removedPixelClusterMask );
434 
435 
436 }
#define LogDebug(id)
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > stripClusters_
int i
Definition: DBlmapReader.cc:9
string fill
Definition: lumiContext.py:319
ProductID id() const
Definition: HandleBase.cc:15
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelClusters_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
edm::EDGetTokenT< PixelMaskContainer > oldPxlMaskToken_
edm::ContainerMask< edmNew::DetSetVector< SiStripCluster > > StripMaskContainer
DataContainer const & measurements() const
Definition: Trajectory.h:203
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
ParamBlock pblocks_[NumberOfParamBlocks]
edm::EDGetTokenT< std::vector< Trajectory > > trajectories_
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
Definition: DetId.h:18
bool isValid() const
void process(const TrackingRecHit *hit, float chi2)
edm::ContainerMask< edmNew::DetSetVector< SiPixelCluster > > PixelMaskContainer
edm::EDGetTokenT< StripMaskContainer > oldStrMaskToken_
void HLTTrackClusterRemoverNew::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 103 of file HLTTrackClusterRemoverNew.cc.

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

Referenced by HLTTrackClusterRemoverNew().

105 {
106  if (iConfig.exists(name)) {
107  ParamBlock pblock(iConfig.getParameter<ParameterSet>(name));
108  if (id1 == -1) {
110  } else {
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;
117  }
118  }
119 }
T getParameter(std::string const &) const
string fill
Definition: lumiContext.py:319
static const unsigned int NumberOfParamBlocks
bool exists(std::string const &parameterName) const
checks if a parameter exists
ParamBlock pblocks_[NumberOfParamBlocks]

Member Data Documentation

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

Definition at line 93 of file HLTTrackClusterRemoverNew.cc.

Referenced by process(), and produce().

std::vector<bool> HLTTrackClusterRemoverNew::collectedRegStrips_
private

Definition at line 92 of file HLTTrackClusterRemoverNew.cc.

Referenced by process(), and produce().

bool HLTTrackClusterRemoverNew::doPixel_
private

Definition at line 60 of file HLTTrackClusterRemoverNew.cc.

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

bool HLTTrackClusterRemoverNew::doPixelChargeCheck_
private

Definition at line 91 of file HLTTrackClusterRemoverNew.cc.

Referenced by HLTTrackClusterRemoverNew().

bool HLTTrackClusterRemoverNew::doStrip_
private

Definition at line 60 of file HLTTrackClusterRemoverNew.cc.

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

bool HLTTrackClusterRemoverNew::doStripChargeCheck_
private

Definition at line 91 of file HLTTrackClusterRemoverNew.cc.

Referenced by HLTTrackClusterRemoverNew(), and produce().

bool HLTTrackClusterRemoverNew::doTracks_
private

Definition at line 59 of file HLTTrackClusterRemoverNew.cc.

Referenced by HLTTrackClusterRemoverNew().

bool HLTTrackClusterRemoverNew::makeProducts_
private

Definition at line 90 of file HLTTrackClusterRemoverNew.cc.

bool HLTTrackClusterRemoverNew::mergeOld_
private

Definition at line 61 of file HLTTrackClusterRemoverNew.cc.

Referenced by HLTTrackClusterRemoverNew(), and produce().

const unsigned int HLTTrackClusterRemoverNew::NumberOfParamBlocks = 6
staticprivate

Definition at line 57 of file HLTTrackClusterRemoverNew.cc.

Referenced by HLTTrackClusterRemoverNew(), and process().

edm::EDGetTokenT<PixelMaskContainer> HLTTrackClusterRemoverNew::oldPxlMaskToken_
private

Definition at line 67 of file HLTTrackClusterRemoverNew.cc.

Referenced by HLTTrackClusterRemoverNew(), and produce().

edm::EDGetTokenT<StripMaskContainer> HLTTrackClusterRemoverNew::oldStrMaskToken_
private

Definition at line 68 of file HLTTrackClusterRemoverNew.cc.

Referenced by HLTTrackClusterRemoverNew(), and produce().

ParamBlock HLTTrackClusterRemoverNew::pblocks_[NumberOfParamBlocks]
private

Definition at line 72 of file HLTTrackClusterRemoverNew.cc.

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

edm::EDGetTokenT<edmNew::DetSetVector<SiPixelCluster> > HLTTrackClusterRemoverNew::pixelClusters_
private

Definition at line 65 of file HLTTrackClusterRemoverNew.cc.

Referenced by HLTTrackClusterRemoverNew(), and produce().

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

Definition at line 76 of file HLTTrackClusterRemoverNew.cc.

edm::ProductID HLTTrackClusterRemoverNew::pixelSourceProdID
private

Definition at line 77 of file HLTTrackClusterRemoverNew.cc.

Referenced by process(), and produce().

edm::EDGetTokenT<edmNew::DetSetVector<SiStripCluster> > HLTTrackClusterRemoverNew::stripClusters_
private

Definition at line 66 of file HLTTrackClusterRemoverNew.cc.

Referenced by HLTTrackClusterRemoverNew(), and produce().

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

Definition at line 76 of file HLTTrackClusterRemoverNew.cc.

edm::ProductID HLTTrackClusterRemoverNew::stripSourceProdID
private

Definition at line 77 of file HLTTrackClusterRemoverNew.cc.

Referenced by process(), and produce().

edm::EDGetTokenT<std::vector<Trajectory> > HLTTrackClusterRemoverNew::trajectories_
private

Definition at line 69 of file HLTTrackClusterRemoverNew.cc.

Referenced by HLTTrackClusterRemoverNew(), and produce().