CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
ReducedESRecHitCollectionProducer Class Reference

#include <ReducedESRecHitCollectionProducer.h>

Inheritance diagram for ReducedESRecHitCollectionProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void beginRun (edm::Run const &, const edm::EventSetup &) overridefinal
 
void collectIds (const ESDetId strip1, const ESDetId strip2, const int &row=0)
 
void produce (edm::Event &e, const edm::EventSetup &c)
 
 ReducedESRecHitCollectionProducer (const edm::ParameterSet &pset)
 
virtual ~ReducedESRecHitCollectionProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
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 ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

std::set< DetIdcollectedIds_
 
const EcalPreshowerGeometrygeometry_p
 
edm::InputTag InputRecHitES_
 
edm::InputTag InputSpuerClusterEE_
 
std::vector< edm::InputTaginterestingDetIdCollections_
 
std::string OutputLabelES_
 
double scEtThresh_
 
CaloSubdetectorTopologytopology_p
 

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
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 23 of file ReducedESRecHitCollectionProducer.h.

Constructor & Destructor Documentation

ReducedESRecHitCollectionProducer::ReducedESRecHitCollectionProducer ( const edm::ParameterSet pset)

Definition at line 21 of file ReducedESRecHitCollectionProducer.cc.

References edm::ParameterSet::getParameter(), InputRecHitES_, InputSpuerClusterEE_, interestingDetIdCollections_, OutputLabelES_, scEtThresh_, and AlCaHLTBitMon_QueryRunRegistry::string.

21  :
22  geometry_p(0),
23  topology_p(0)
24 {
25 
26  scEtThresh_ = ps.getParameter<double>("scEtThreshold");
27 
28  InputRecHitES_ = ps.getParameter<edm::InputTag>("EcalRecHitCollectionES");
29  InputSpuerClusterEE_ = ps.getParameter<edm::InputTag>("EndcapSuperClusterCollection");
30 
31  OutputLabelES_ = ps.getParameter<std::string>("OutputLabel_ES");
32 
33  interestingDetIdCollections_ = ps.getParameter<std::vector< edm::InputTag> >("interestingDetIds");
34 
35  produces< EcalRecHitCollection > (OutputLabelES_);
36 
37 }
std::vector< edm::InputTag > interestingDetIdCollections_
ReducedESRecHitCollectionProducer::~ReducedESRecHitCollectionProducer ( )
virtual

Definition at line 39 of file ReducedESRecHitCollectionProducer.cc.

References topology_p.

39  {
40  if (topology_p) delete topology_p;
41 }

Member Function Documentation

void ReducedESRecHitCollectionProducer::beginRun ( edm::Run const &  ,
const edm::EventSetup iSetup 
)
finaloverridevirtual

Reimplemented from edm::EDProducer.

Definition at line 43 of file ReducedESRecHitCollectionProducer.cc.

References DetId::Ecal, EcalPreshower, geometry, geometry_p, edm::EventSetup::get(), and topology_p.

43  {
44  ESHandle<CaloGeometry> geoHandle;
45  iSetup.get<CaloGeometryRecord>().get(geoHandle);
46  const CaloSubdetectorGeometry *geometry = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalPreshower);
47  geometry_p = dynamic_cast<const EcalPreshowerGeometry *>(geometry);
48  if (!geometry_p){
49  edm::LogError("WrongGeometry")<<
50  "could not cast the subdet geometry to preshower geometry";
51  }
52 
53  if (geometry) topology_p = new EcalPreshowerTopology(geoHandle);
54 
55 }
const T & get() const
Definition: EventSetup.h:55
ESHandle< TrackerGeometry > geometry
void ReducedESRecHitCollectionProducer::collectIds ( const ESDetId  strip1,
const ESDetId  strip2,
const int &  row = 0 
)

Definition at line 125 of file ReducedESRecHitCollectionProducer.cc.

References collectedIds_, i, and topology_p.

Referenced by produce().

125  {
126 
127  //cout<<row<<endl;
128 
129  map<DetId,const EcalRecHit*>::iterator it;
130  map<DetId, int>::iterator itu;
131  ESDetId next;
132  ESDetId strip1;
133  ESDetId strip2;
134 
135  strip1 = esDetId1;
136  strip2 = esDetId2;
137 
138  EcalPreshowerNavigator theESNav1(strip1, topology_p);
139  theESNav1.setHome(strip1);
140 
141  EcalPreshowerNavigator theESNav2(strip2, topology_p);
142  theESNav2.setHome(strip2);
143 
144  if (row == 1) {
145  if (strip1 != ESDetId(0)) strip1 = theESNav1.north();
146  if (strip2 != ESDetId(0)) strip2 = theESNav2.east();
147  } else if (row == -1) {
148  if (strip1 != ESDetId(0)) strip1 = theESNav1.south();
149  if (strip2 != ESDetId(0)) strip2 = theESNav2.west();
150  }
151 
152  // Plane 1
153  if (strip1 == ESDetId(0)) {
154  } else {
155  collectedIds_.insert(strip1);
156  //cout<<"center : "<<strip1<<endl;
157  // east road
158  for (int i=0; i<15; ++i) {
159  next = theESNav1.east();
160  //cout<<"east : "<<i<<" "<<next<<endl;
161  if (next != ESDetId(0)) {
162  collectedIds_.insert(next);
163  } else {
164  break;
165  }
166  }
167 
168  // west road
169  theESNav1.setHome(strip1);
170  theESNav1.home();
171  for (int i=0; i<15; ++i) {
172  next = theESNav1.west();
173  //cout<<"west : "<<i<<" "<<next<<endl;
174  if (next != ESDetId(0)) {
175  collectedIds_.insert(next);
176  } else {
177  break;
178  }
179  }
180 
181  }
182 
183  if (strip2 == ESDetId(0)) {
184  } else {
185  collectedIds_.insert(strip2);
186  //cout<<"center : "<<strip2<<endl;
187  // north road
188  for (int i=0; i<15; ++i) {
189  next = theESNav2.north();
190  //cout<<"north : "<<i<<" "<<next<<endl;
191  if (next != ESDetId(0)) {
192  collectedIds_.insert(next);
193  } else {
194  break;
195  }
196  }
197 
198  // south road
199  theESNav2.setHome(strip2);
200  theESNav2.home();
201  for (int i=0; i<15; ++i) {
202  next = theESNav2.south();
203  //cout<<"south : "<<i<<" "<<next<<endl;
204  if (next != ESDetId(0)) {
205  collectedIds_.insert(next);
206  } else {
207  break;
208  }
209  }
210  }
211 }
CaloNavigator< ESDetId > EcalPreshowerNavigator
int i
Definition: DBlmapReader.cc:9
void ReducedESRecHitCollectionProducer::produce ( edm::Event e,
const edm::EventSetup c 
)
virtual

Implements edm::EDProducer.

Definition at line 57 of file ReducedESRecHitCollectionProducer.cc.

References collectedIds_, collectIds(), geometry_p, edm::Event::getByLabel(), EcalPreshowerGeometry::getClosestCellInPlane(), InputRecHitES_, InputSpuerClusterEE_, interestingDetIdCollections_, edm::HandleBase::isValid(), convertSQLitetoXML_cfg::output, OutputLabelES_, point, edm::Handle< T >::product(), edm::Event::put(), scEtThresh_, and lumiQTWidget::t.

57  {
58 
59 
61  e.getByLabel(InputRecHitES_, ESRecHits_);
62 
63  std::auto_ptr<EcalRecHitCollection> output(new EcalRecHitCollection);
64 
65  edm::Handle<reco::SuperClusterCollection> pEndcapSuperClusters;
66  e.getByLabel(InputSpuerClusterEE_, pEndcapSuperClusters);
67  {
68  const reco::SuperClusterCollection* eeSuperClusters = pEndcapSuperClusters.product();
69 
70  for (reco::SuperClusterCollection::const_iterator isc = eeSuperClusters->begin(); isc != eeSuperClusters->end(); ++isc) {
71 
72  if (isc->energy() < scEtThresh_) continue;
73  if (fabs(isc->eta()) < 1.65 || fabs(isc->eta()) > 2.6) continue;
74  //cout<<"SC energy : "<<isc->energy()<<" "<<isc->eta()<<endl;
75 
76  //Int_t nBC = 0;
77  reco::CaloCluster_iterator ibc = isc->clustersBegin();
78  for ( ; ibc != isc->clustersEnd(); ++ibc ) {
79 
80  //cout<<"BC : "<<nBC<<endl;
81 
82  const GlobalPoint point((*ibc)->x(),(*ibc)->y(),(*ibc)->z());
83 
86 
87  collectIds(esId1, esId2, 0);
88  collectIds(esId1, esId2, 1);
89  collectIds(esId1, esId2, -1);
90 
91  //nBC++;
92  }
93 
94  }
95 
96  }
97 
98 
100  for( unsigned int t = 0; t < interestingDetIdCollections_.size(); ++t )
101  {
103  if (!detId.isValid()){
104  edm::LogError("MissingInput")<<"the collection of interesting detIds:"<<interestingDetIdCollections_[t]<<" is not found.";
105  continue;
106  }
107  collectedIds_.insert(detId->begin(),detId->end());
108  }
109 
110 
111  output->reserve( collectedIds_.size());
113  for (it = ESRecHits_->begin(); it != ESRecHits_->end(); ++it) {
114  if (it->recoFlag()==1 || it->recoFlag()==14 || (it->recoFlag()<=10 && it->recoFlag()>=5)) continue;
115  if (collectedIds_.find(it->id())!=collectedIds_.end()){
116  output->push_back(*it);
117  }
118  }
119  collectedIds_.clear();
120 
122 
123 }
std::vector< EcalRecHit >::const_iterator const_iterator
void collectIds(const ESDetId strip1, const ESDetId strip2, const int &row=0)
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
virtual DetId getClosestCellInPlane(const GlobalPoint &r, int plane) const
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
std::vector< edm::InputTag > interestingDetIdCollections_
T const * product() const
Definition: Handle.h:74
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5

Member Data Documentation

std::set<DetId> ReducedESRecHitCollectionProducer::collectedIds_
private

Definition at line 45 of file ReducedESRecHitCollectionProducer.h.

Referenced by collectIds(), and produce().

const EcalPreshowerGeometry* ReducedESRecHitCollectionProducer::geometry_p
private

Definition at line 35 of file ReducedESRecHitCollectionProducer.h.

Referenced by beginRun(), and produce().

edm::InputTag ReducedESRecHitCollectionProducer::InputRecHitES_
private
edm::InputTag ReducedESRecHitCollectionProducer::InputSpuerClusterEE_
private
std::vector<edm::InputTag> ReducedESRecHitCollectionProducer::interestingDetIdCollections_
private
std::string ReducedESRecHitCollectionProducer::OutputLabelES_
private
double ReducedESRecHitCollectionProducer::scEtThresh_
private
CaloSubdetectorTopology* ReducedESRecHitCollectionProducer::topology_p
private