CMS 3D CMS Logo

PreshowerClusterShapeProducer Class Reference

#include <RecoEcal/EgammaClusterProducers/interface/PreshowerClusterShapeProducer.h>

Inheritance diagram for PreshowerClusterShapeProducer:

edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Types

typedef math::XYZPoint Point

Public Member Functions

 PreshowerClusterShapeProducer (const edm::ParameterSet &ps)
 ----
virtual void produce (edm::Event &evt, const edm::EventSetup &es)
 ~PreshowerClusterShapeProducer ()

Private Attributes

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


Detailed Description

Definition at line 24 of file PreshowerClusterShapeProducer.h.


Member Typedef Documentation

typedef math::XYZPoint PreshowerClusterShapeProducer::Point

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 GenMuonPlsPt100GeV_cfg::cout, debugL_pi0, endcapSClusterProducer_, lat::endl(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), nEvt_, EndcapPiZeroDiscriminatorAlgo::pDEBUG, EndcapPiZeroDiscriminatorAlgo::pERROR, EndcapPiZeroDiscriminatorAlgo::pINFO, presh_pi0_algo, preshHitProducer_, PreshowerClusterShapeCollectionX_, and PreshowerClusterShapeCollectionY_.

00040                                                                                    {
00041   // use configuration file to setup input/output collection names
00042   // Parameters to identify the hit collections
00043   preshHitProducer_   = ps.getParameter<edm::InputTag>("preshRecHitProducer");
00044   endcapSClusterProducer_   = ps.getParameter<edm::InputTag>("endcapSClusterProducer");
00045 
00046   PreshowerClusterShapeCollectionX_ = ps.getParameter<string>("PreshowerClusterShapeCollectionX");
00047   PreshowerClusterShapeCollectionY_ = ps.getParameter<string>("PreshowerClusterShapeCollectionY");
00048 
00049   produces< reco::PreshowerClusterShapeCollection >(PreshowerClusterShapeCollectionX_);
00050   produces< reco::PreshowerClusterShapeCollection >(PreshowerClusterShapeCollectionY_);
00051   
00052   float preshStripECut = ps.getParameter<double>("preshStripEnergyCut");
00053   int preshNst = ps.getParameter<int>("preshPi0Nstrip");
00054   
00055   string debugString = ps.getParameter<string>("debugLevel");
00056 
00057   if      (debugString == "DEBUG")   debugL_pi0 = EndcapPiZeroDiscriminatorAlgo::pDEBUG;
00058   else if (debugString == "INFO")    debugL_pi0 = EndcapPiZeroDiscriminatorAlgo::pINFO;
00059   else                               debugL_pi0 = EndcapPiZeroDiscriminatorAlgo::pERROR;
00060 
00061   string tmpPath = ps.getUntrackedParameter<string>("pathToWeightFiles","RecoEcal/EgammaClusterProducers/data/");
00062   
00063   presh_pi0_algo = new EndcapPiZeroDiscriminatorAlgo(preshStripECut, preshNst, tmpPath.c_str(), debugL_pi0); 
00064 
00065   if ( debugL_pi0 == EndcapPiZeroDiscriminatorAlgo::pDEBUG ) 
00066                   cout << "PreshowerClusterShapeProducer:presh_pi0_algo class instantiated " << endl; 
00067   
00068   nEvt_ = 0;
00069 
00070 }

PreshowerClusterShapeProducer::~PreshowerClusterShapeProducer (  ) 

Definition at line 73 of file PreshowerClusterShapeProducer.cc.

References presh_pi0_algo.

00073                                                               {
00074    delete presh_pi0_algo;
00075 }


Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 78 of file PreshowerClusterShapeProducer.cc.

References edm::SortedCollection< T, SORT >::begin(), GenMuonPlsPt100GeV_cfg::cout, debugL_pi0, DetId::Ecal, EcalPreshower, edm::SortedCollection< T, SORT >::end(), endcapSClusterProducer_, lat::endl(), funct::exp(), EndcapPiZeroDiscriminatorAlgo::findPreshVector(), edm::EventSetup::get(), edm::Event::getByLabel(), edm::Event::id(), it, LogDebug, nEvt_, EndcapPiZeroDiscriminatorAlgo::pDEBUG, presh_pi0_algo, preshHitProducer_, PreshowerClusterShapeCollectionX_, PreshowerClusterShapeCollectionY_, edm::Handle< T >::product(), edm::Event::put(), reco::PreshowerClusterShape::setSCRef(), funct::sin(), and edm::SortedCollection< T, SORT >::size().

00078                                                                             {
00079 
00080   ostringstream ostr; // use this stream for all messages in produce
00081 
00082   if ( debugL_pi0 <= EndcapPiZeroDiscriminatorAlgo::pDEBUG )
00083        cout << "\n .......  Event " << evt.id() << " with Number = " <<  nEvt_+1
00084             << " is analyzing ....... " << endl << endl;
00085 
00086   Handle< EcalRecHitCollection >   pRecHits;
00087   Handle< SuperClusterCollection > pSuperClusters;
00088 
00089   // get the ECAL -> Preshower geometry and topology:
00090   ESHandle<CaloGeometry> geoHandle;
00091   es.get<CaloGeometryRecord>().get(geoHandle);
00092   const CaloSubdetectorGeometry *geometry = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalPreshower);
00093   const CaloSubdetectorGeometry *& geometry_p = geometry;
00094 
00095 
00096   // create an auto_ptr to a PreshowerClusterShapeCollection
00097   std::auto_ptr< reco::PreshowerClusterShapeCollection > ps_cl_for_pi0_disc_x(new reco::PreshowerClusterShapeCollection);
00098   std::auto_ptr< reco::PreshowerClusterShapeCollection > ps_cl_for_pi0_disc_y(new reco::PreshowerClusterShapeCollection);
00099 
00100 
00101   CaloSubdetectorTopology* topology_p=0;
00102   if (geometry)
00103       topology_p = new EcalPreshowerTopology(geoHandle);
00104 
00105   
00106   // fetch the Preshower product (RecHits)
00107   evt.getByLabel( preshHitProducer_, pRecHits);
00108   // pointer to the object in the product
00109   const EcalRecHitCollection* rechits = pRecHits.product(); 
00110   
00111   if ( debugL_pi0 == EndcapPiZeroDiscriminatorAlgo::pDEBUG ) 
00112     cout << "PreshowerClusterShapeProducer: ### Total # of preshower RecHits: "
00113          << rechits->size() << endl;
00114   
00115   //  if ( rechits->size() <= 0 ) return;
00116   
00117   // make the map of Preshower rechits:
00118   map<DetId, EcalRecHit> rechits_map;
00119   EcalRecHitCollection::const_iterator it;
00120   for (it = rechits->begin(); it != rechits->end(); it++) {
00121      rechits_map.insert(make_pair(it->id(), *it));
00122   }
00123   if ( debugL_pi0 <= EndcapPiZeroDiscriminatorAlgo::pDEBUG ) cout
00124     << "PreshowerClusterShapeProducer: ### Preshower RecHits_map of size "
00125                                 << rechits_map.size() <<" was created!" << endl; 
00126   
00127   reco::PreshowerClusterShapeCollection ps_cl_x, ps_cl_y;
00128 
00129   //make cycle over Photon Collection
00130   int SC_index  = 0;
00131 //  Handle<PhotonCollection> correctedPhotonHandle; 
00132 //  evt.getByLabel(photonCorrCollectionProducer_, correctedPhotonCollection_ , correctedPhotonHandle);
00133 //  const PhotonCollection corrPhoCollection = *(correctedPhotonHandle.product());
00134 //  cout << " Photon Collection size : " << corrPhoCollection.size() << endl;
00135 
00136   evt.getByLabel(endcapSClusterProducer_, pSuperClusters);
00137   const reco::SuperClusterCollection* SClusts = pSuperClusters.product();
00138   if ( debugL_pi0 <= EndcapPiZeroDiscriminatorAlgo::pDEBUG ) cout <<"### Total # Endcap Superclusters: " << SClusts->size() << endl;
00139   SuperClusterCollection::const_iterator it_s;
00140   for ( it_s=SClusts->begin();  it_s!=SClusts->end(); it_s++ ) {
00141 
00142       SuperClusterRef it_super(reco::SuperClusterRef(pSuperClusters,SC_index));
00143       
00144       float SC_Et   = it_super->energy()*sin(2*atan(exp(-it_super->eta())));
00145       float SC_eta  = it_super->eta();
00146       float SC_phi  = it_super->phi();
00147 
00148       if ( debugL_pi0 <= EndcapPiZeroDiscriminatorAlgo::pDEBUG ) {
00149         cout << "PreshowerClusterShapeProducer: superCl_E = " << it_super->energy()
00150                   << " superCl_Et = " << SC_Et
00151                   << " superCl_Eta = " << SC_eta
00152                   << " superCl_Phi = " << SC_phi << endl;
00153       }                    
00154       
00155       if(fabs(SC_eta) >= 1.65 && fabs(SC_eta) <= 2.5) 
00156         {  //  Use Preshower region only
00157           if (geometry)
00158             {
00159               const GlobalPoint pointSC(it_super->x(),it_super->y(),it_super->z()); // get the centroid of the SC
00160               if ( debugL_pi0 <= EndcapPiZeroDiscriminatorAlgo::pDEBUG ) cout << "SC centroind = " << pointSC << endl;
00161               
00162               // Get the Preshower 2-planes RecHit vectors associated with the given SC
00163               
00164               DetId tmp_stripX = (dynamic_cast<const EcalPreshowerGeometry*>(geometry_p))->getClosestCellInPlane(pointSC, 1);
00165               DetId tmp_stripY = (dynamic_cast<const EcalPreshowerGeometry*>(geometry_p))->getClosestCellInPlane(pointSC, 2);
00166               ESDetId stripX = (tmp_stripX == DetId(0)) ? ESDetId(0) : ESDetId(tmp_stripX);
00167               ESDetId stripY = (tmp_stripY == DetId(0)) ? ESDetId(0) : ESDetId(tmp_stripY);
00168               
00169               vector<float> vout_stripE1 = presh_pi0_algo->findPreshVector(stripX, &rechits_map, topology_p);
00170               vector<float> vout_stripE2 = presh_pi0_algo->findPreshVector(stripY, &rechits_map, topology_p);
00171               
00172               if ( debugL_pi0 <= EndcapPiZeroDiscriminatorAlgo::pDEBUG ) {
00173                 cout  << "PreshowerClusterShapeProducer : ES Energy vector associated to the given SC = " ;
00174                 for(int k1=0;k1<11;k1++) {
00175                   cout  << vout_stripE1[k1] << " " ;
00176                 }
00177                 for(int k1=0;k1<11;k1++) {
00178                   cout  << vout_stripE2[k1] << " " ;
00179                 }           
00180                 cout  << endl;
00181               } 
00182               
00183               reco::PreshowerClusterShape ps1 = reco::PreshowerClusterShape(vout_stripE1,1);
00184               ps1.setSCRef(it_super);
00185               ps_cl_x.push_back(ps1);
00186               
00187               reco::PreshowerClusterShape ps2 = reco::PreshowerClusterShape(vout_stripE2,2);
00188               ps2.setSCRef(it_super);
00189               ps_cl_y.push_back(ps2);
00190               
00191             }
00192           SC_index++;
00193         } // end of cycle over Endcap SC       
00194   } 
00195   // put collection of PreshowerClusterShape in the Event:
00196   ps_cl_for_pi0_disc_x->assign(ps_cl_x.begin(), ps_cl_x.end());
00197   ps_cl_for_pi0_disc_y->assign(ps_cl_y.begin(), ps_cl_y.end());
00198   
00199   evt.put(ps_cl_for_pi0_disc_x, PreshowerClusterShapeCollectionX_);
00200   evt.put(ps_cl_for_pi0_disc_y, PreshowerClusterShapeCollectionY_);  
00201   
00202   if ( debugL_pi0 <= EndcapPiZeroDiscriminatorAlgo::pDEBUG ) cout << "PreshowerClusterShapeCollection added to the event" << endl;
00203 
00204   if (topology_p)
00205     delete topology_p;
00206 
00207   nEvt_++;
00208 
00209   LogDebug("PiZeroDiscriminatorDebug") << ostr.str();
00210 }


Member Data Documentation

EndcapPiZeroDiscriminatorAlgo::DebugLevel_pi0 PreshowerClusterShapeProducer::debugL_pi0 [private]

Definition at line 53 of file PreshowerClusterShapeProducer.h.

Referenced by PreshowerClusterShapeProducer(), and produce().

edm::InputTag PreshowerClusterShapeProducer::endcapSClusterProducer_ [private]

Definition at line 43 of file PreshowerClusterShapeProducer.h.

Referenced by PreshowerClusterShapeProducer(), and produce().

int PreshowerClusterShapeProducer::nEvt_ [private]

Definition at line 38 of file PreshowerClusterShapeProducer.h.

Referenced by PreshowerClusterShapeProducer(), and produce().

EndcapPiZeroDiscriminatorAlgo* PreshowerClusterShapeProducer::presh_pi0_algo [private]

Definition at line 51 of file PreshowerClusterShapeProducer.h.

Referenced by PreshowerClusterShapeProducer(), produce(), and ~PreshowerClusterShapeProducer().

edm::InputTag PreshowerClusterShapeProducer::preshHitProducer_ [private]

Definition at line 42 of file PreshowerClusterShapeProducer.h.

Referenced by PreshowerClusterShapeProducer(), and produce().

std::string PreshowerClusterShapeProducer::PreshowerClusterShapeCollectionX_ [private]

Definition at line 48 of file PreshowerClusterShapeProducer.h.

Referenced by PreshowerClusterShapeProducer(), and produce().

std::string PreshowerClusterShapeProducer::PreshowerClusterShapeCollectionY_ [private]

Definition at line 49 of file PreshowerClusterShapeProducer.h.

Referenced by PreshowerClusterShapeProducer(), and produce().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:30:16 2009 for CMSSW by  doxygen 1.5.4