CMS 3D CMS Logo

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

#include <PreshowerClusterShapeProducer.h>

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

Public Types

typedef math::XYZPoint Point
 
- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 

Public Member Functions

 PreshowerClusterShapeProducer (const edm::ParameterSet &ps)
 
More...
 
virtual void produce (edm::Event &evt, const edm::EventSetup &es)
 
 ~PreshowerClusterShapeProducer ()
 
- 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

edm::InputTag endcapSClusterProducer_
 
int nEvt_
 
EndcapPiZeroDiscriminatorAlgopresh_pi0_algo
 
edm::InputTag preshHitProducer_
 
std::string PreshowerClusterShapeCollectionX_
 
std::string PreshowerClusterShapeCollectionY_
 

Additional Inherited Members

- 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 24 of file PreshowerClusterShapeProducer.h.

Member Typedef Documentation

Definition at line 28 of file PreshowerClusterShapeProducer.h.

Constructor & Destructor Documentation

PreshowerClusterShapeProducer::PreshowerClusterShapeProducer ( const edm::ParameterSet ps)
explicit


Definition at line 40 of file PreshowerClusterShapeProducer.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), and LogTrace.

40  {
41  // use configuration file to setup input/output collection names
42  // Parameters to identify the hit collections
43  preshHitProducer_ = ps.getParameter<edm::InputTag>("preshRecHitProducer");
44  endcapSClusterProducer_ = ps.getParameter<edm::InputTag>("endcapSClusterProducer");
45 
46  PreshowerClusterShapeCollectionX_ = ps.getParameter<string>("PreshowerClusterShapeCollectionX");
47  PreshowerClusterShapeCollectionY_ = ps.getParameter<string>("PreshowerClusterShapeCollectionY");
48 
49  produces< reco::PreshowerClusterShapeCollection >(PreshowerClusterShapeCollectionX_);
50  produces< reco::PreshowerClusterShapeCollection >(PreshowerClusterShapeCollectionY_);
51 
52  float preshStripECut = ps.getParameter<double>("preshStripEnergyCut");
53  int preshNst = ps.getParameter<int>("preshPi0Nstrip");
54 
55  string debugString = ps.getParameter<string>("debugLevel");
56 
57 
58  string tmpPath = ps.getUntrackedParameter<string>("pathToWeightFiles","RecoEcal/EgammaClusterProducers/data/");
59 
60  presh_pi0_algo = new EndcapPiZeroDiscriminatorAlgo(preshStripECut, preshNst, tmpPath.c_str());
61 
62  LogTrace("EcalClusters") << "PreshowerClusterShapeProducer:presh_pi0_algo class instantiated " ;
63 
64 
65  nEvt_ = 0;
66 
67 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
#define LogTrace(id)
EndcapPiZeroDiscriminatorAlgo * presh_pi0_algo
PreshowerClusterShapeProducer::~PreshowerClusterShapeProducer ( )

Definition at line 70 of file PreshowerClusterShapeProducer.cc.

70  {
71  delete presh_pi0_algo;
72 }
EndcapPiZeroDiscriminatorAlgo * presh_pi0_algo

Member Function Documentation

void PreshowerClusterShapeProducer::produce ( edm::Event evt,
const edm::EventSetup es 
)
virtual

Implements edm::EDProducer.

Definition at line 75 of file PreshowerClusterShapeProducer.cc.

References edm::SortedCollection< T, SORT >::begin(), DetId::Ecal, EcalPreshower, edm::SortedCollection< T, SORT >::end(), create_public_lumi_plots::exp, geometry, edm::EventSetup::get(), edm::Event::getByLabel(), edm::EventBase::id(), LogDebug, LogTrace, edm::Handle< T >::product(), edm::Event::put(), HI_PhotonSkim_cff::rechits, reco::PreshowerClusterShape::setSCRef(), funct::sin(), and edm::SortedCollection< T, SORT >::size().

75  {
76 
77  ostringstream ostr; // use this stream for all messages in produce
78 
79  LogTrace("EcalClusters") << "\n ....... Event " << evt.id() << " with Number = " << nEvt_+1 << " is analyzing ....... " ;
80 
81 
83  Handle< SuperClusterCollection > pSuperClusters;
84 
85  // get the ECAL -> Preshower geometry and topology:
86  ESHandle<CaloGeometry> geoHandle;
87  es.get<CaloGeometryRecord>().get(geoHandle);
88  const CaloSubdetectorGeometry *geometry = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalPreshower);
89  const CaloSubdetectorGeometry *& geometry_p = geometry;
90 
91 
92  // create an auto_ptr to a PreshowerClusterShapeCollection
93  std::auto_ptr< reco::PreshowerClusterShapeCollection > ps_cl_for_pi0_disc_x(new reco::PreshowerClusterShapeCollection);
94  std::auto_ptr< reco::PreshowerClusterShapeCollection > ps_cl_for_pi0_disc_y(new reco::PreshowerClusterShapeCollection);
95 
96 
97  CaloSubdetectorTopology* topology_p=0;
98  if (geometry)
99  topology_p = new EcalPreshowerTopology(geoHandle);
100 
101 
102  // fetch the Preshower product (RecHits)
103  evt.getByLabel( preshHitProducer_, pRecHits);
104  // pointer to the object in the product
105  const EcalRecHitCollection* rechits = pRecHits.product();
106 
107  LogTrace("EcalClusters") << "PreshowerClusterShapeProducer: ### Total # of preshower RecHits: " << rechits->size() ;
108 
109  // if ( rechits->size() <= 0 ) return;
110 
111  // make the map of Preshower rechits:
112  map<DetId, EcalRecHit> rechits_map;
114  for (it = rechits->begin(); it != rechits->end(); it++) {
115  rechits_map.insert(make_pair(it->id(), *it));
116  }
117 
118  LogTrace("EcalClusters") << "PreshowerClusterShapeProducer: ### Preshower RecHits_map of size " << rechits_map.size() <<" was created!" ;
119 
120  reco::PreshowerClusterShapeCollection ps_cl_x, ps_cl_y;
121 
122  //make cycle over Photon Collection
123  int SC_index = 0;
124 // Handle<PhotonCollection> correctedPhotonHandle;
125 // evt.getByLabel(photonCorrCollectionProducer_, correctedPhotonCollection_ , correctedPhotonHandle);
126 // const PhotonCollection corrPhoCollection = *(correctedPhotonHandle.product());
127 // cout << " Photon Collection size : " << corrPhoCollection.size() << endl;
128 
129  evt.getByLabel(endcapSClusterProducer_, pSuperClusters);
130  const reco::SuperClusterCollection* SClusts = pSuperClusters.product();
131  LogTrace("EcalClusters") << "### Total # Endcap Superclusters: " << SClusts->size() ;
132 
133  SuperClusterCollection::const_iterator it_s;
134  for ( it_s=SClusts->begin(); it_s!=SClusts->end(); it_s++ ) {
135 
136  SuperClusterRef it_super(reco::SuperClusterRef(pSuperClusters,SC_index));
137 
138  float SC_Et = it_super->energy()*sin(2*atan(exp(-it_super->eta())));
139  float SC_eta = it_super->eta();
140  float SC_phi = it_super->phi();
141 
142  LogTrace("EcalClusters") << "PreshowerClusterShapeProducer: superCl_E = " << it_super->energy() << " superCl_Et = " << SC_Et << " superCl_Eta = " << SC_eta << " superCl_Phi = " << SC_phi ;
143 
144 
145  if(fabs(SC_eta) >= 1.65 && fabs(SC_eta) <= 2.5)
146  { // Use Preshower region only
147  if (geometry)
148  {
149  const GlobalPoint pointSC(it_super->x(),it_super->y(),it_super->z()); // get the centroid of the SC
150  LogTrace("EcalClusters") << "SC centroind = " << pointSC ;
151 
152  // Get the Preshower 2-planes RecHit vectors associated with the given SC
153 
154  DetId tmp_stripX = (dynamic_cast<const EcalPreshowerGeometry*>(geometry_p))->getClosestCellInPlane(pointSC, 1);
155  DetId tmp_stripY = (dynamic_cast<const EcalPreshowerGeometry*>(geometry_p))->getClosestCellInPlane(pointSC, 2);
156  ESDetId stripX = (tmp_stripX == DetId(0)) ? ESDetId(0) : ESDetId(tmp_stripX);
157  ESDetId stripY = (tmp_stripY == DetId(0)) ? ESDetId(0) : ESDetId(tmp_stripY);
158 
159  vector<float> vout_stripE1 = presh_pi0_algo->findPreshVector(stripX, &rechits_map, topology_p);
160  vector<float> vout_stripE2 = presh_pi0_algo->findPreshVector(stripY, &rechits_map, topology_p);
161 
162  LogTrace("EcalClusters") << "PreshowerClusterShapeProducer : ES Energy vector associated to the given SC = " ;
163  for(int k1=0;k1<11;k1++) {
164  LogTrace("EcalClusters") << vout_stripE1[k1] << " " ;
165  }
166 
167  for(int k1=0;k1<11;k1++) {
168  LogTrace("EcalClusters") << vout_stripE2[k1] << " " ;
169  }
170 
172  ps1.setSCRef(it_super);
173  ps_cl_x.push_back(ps1);
174 
176  ps2.setSCRef(it_super);
177  ps_cl_y.push_back(ps2);
178 
179  }
180  SC_index++;
181  } // end of cycle over Endcap SC
182  }
183  // put collection of PreshowerClusterShape in the Event:
184  ps_cl_for_pi0_disc_x->assign(ps_cl_x.begin(), ps_cl_x.end());
185  ps_cl_for_pi0_disc_y->assign(ps_cl_y.begin(), ps_cl_y.end());
186 
187  evt.put(ps_cl_for_pi0_disc_x, PreshowerClusterShapeCollectionX_);
188  evt.put(ps_cl_for_pi0_disc_y, PreshowerClusterShapeCollectionY_);
189  LogTrace("EcalClusters") << "PreshowerClusterShapeCollection added to the event" ;
190 
191  if (topology_p)
192  delete topology_p;
193 
194  nEvt_++;
195 
196  LogDebug("PiZeroDiscriminatorDebug") << ostr.str();
197 }
#define LogDebug(id)
void setSCRef(const SuperClusterRef &r)
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
std::vector< EcalRecHit >::const_iterator const_iterator
std::vector< float > findPreshVector(ESDetId strip, RecHitsMap *rechits_map, CaloSubdetectorTopology *topology_p)
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
std::vector< PreshowerClusterShape > PreshowerClusterShapeCollection
collection of PreshowerClusterShape objects
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
#define LogTrace(id)
const_iterator end() const
Definition: DetId.h:20
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: Handle.h:74
ESHandle< TrackerGeometry > geometry
edm::EventID id() const
Definition: EventBase.h:56
EndcapPiZeroDiscriminatorAlgo * presh_pi0_algo
size_type size() const
const_iterator begin() const

Member Data Documentation

edm::InputTag PreshowerClusterShapeProducer::endcapSClusterProducer_
private

Definition at line 43 of file PreshowerClusterShapeProducer.h.

int PreshowerClusterShapeProducer::nEvt_
private

Definition at line 38 of file PreshowerClusterShapeProducer.h.

EndcapPiZeroDiscriminatorAlgo* PreshowerClusterShapeProducer::presh_pi0_algo
private

Definition at line 51 of file PreshowerClusterShapeProducer.h.

edm::InputTag PreshowerClusterShapeProducer::preshHitProducer_
private

Definition at line 42 of file PreshowerClusterShapeProducer.h.

std::string PreshowerClusterShapeProducer::PreshowerClusterShapeCollectionX_
private

Definition at line 48 of file PreshowerClusterShapeProducer.h.

std::string PreshowerClusterShapeProducer::PreshowerClusterShapeCollectionY_
private

Definition at line 49 of file PreshowerClusterShapeProducer.h.