CMS 3D CMS Logo

EcalRawToRecHitRoI Class Reference

#include <EventFilter/EcalRawToDigi/plugins/EcalRawToRecHitRoI.h>

Inheritance diagram for EcalRawToRecHitRoI:

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

List of all members.

Public Member Functions

void beginJob (const edm::EventSetup &c)
 EcalRawToRecHitRoI (const edm::ParameterSet &pset)
void endJob (void)
void produce (edm::Event &e, const edm::EventSetup &c)
virtual ~EcalRawToRecHitRoI ()

Private Types

typedef edm::LazyGetter
< EcalRecHit
EcalRecHitLazyGetter
typedef edm::RefGetter
< EcalRecHit
EcalRecHitRefGetter

Private Member Functions

void Cand (edm::Event &e, const edm::EventSetup &es, std::vector< int > &FEDs)
std::string dumpFEDs (const std::vector< int > &FEDs)
void Egamma (edm::Event &e, const edm::EventSetup &es, std::vector< int > &FEDs)
void Egamma_OneL1EmCollection (const edm::Handle< l1extra::L1EmParticleCollection > emColl, const EmJobPSet &ejpset, const edm::ESHandle< L1CaloGeometry > &l1CaloGeom, std::vector< int > &FEDs)
 process one collection of L1Em
void Jet (edm::Event &e, const edm::EventSetup &es, std::vector< int > &FEDs)
void Jet_OneL1JetCollection (const edm::Handle< l1extra::L1JetParticleCollection > jetColl, const JetJobPSet &jjpset, std::vector< int > &feds)
 process on collection of L1Jets
void ListOfFEDS (double etaLow, double etaHigh, double phiLow, double phiHigh, double etamargin, double phimargin, std::vector< int > &FEDs)
 actually fill the vector with FED numbers
void Muon (edm::Event &e, const edm::EventSetup &es, std::vector< int > &FEDs)
template<typename CollectionType>
void OneCandCollection (const edm::Event &e, const edm::EventSetup &es, const CandJobPSet &cjpset, std::vector< int > &feds)
 process one collection of Candidate-versatile objects
void unique (std::vector< int > &FEDs)
 remove duplicates

Private Attributes

bool All_
 if all need to be done
bool Candidate_
 Candidate-versatile objects part flag.
std::vector< CandJobPSetCandSource_
 what drives the job from candidate
bool EGamma_
 Egamma part flag.
std::vector< EmJobPSetEmSource_
 what drive the job on L1Em collection
bool Jet_
 jet part flag
std::vector< JetJobPSetJetSource_
 what drive the job on L1Jet collection
bool Muon_
 Muon part flag.
MuJobPSet MuonSource_
 what drives the job from ONE L1Muon collection
edm::InputTag sourceTag_
 input tag for the lazy getter
const EcalElectronicsMappingTheMapping
 tools

Classes

class  CalUnpackJobPSet
 generic class to drive the job More...
class  CandJobPSet
 class to drive the job on Candidate-inheriting object More...
class  EmJobPSet
 class to drive the job on L1Em More...
class  JetJobPSet
 class to drive the job on L1Jet More...
class  MuJobPSet
 class to drive the job on L1Muon More...


Detailed Description

Definition at line 38 of file EcalRawToRecHitRoI.h.


Member Typedef Documentation

typedef edm::LazyGetter<EcalRecHit> EcalRawToRecHitRoI::EcalRecHitLazyGetter [private]

Definition at line 40 of file EcalRawToRecHitRoI.h.

typedef edm::RefGetter<EcalRecHit> EcalRawToRecHitRoI::EcalRecHitRefGetter [private]

Definition at line 41 of file EcalRawToRecHitRoI.h.


Constructor & Destructor Documentation

EcalRawToRecHitRoI::EcalRawToRecHitRoI ( const edm::ParameterSet pset  ) 

Definition at line 59 of file EcalRawToRecHitRoI.cc.

References All_, Candidate_, CandSource_, category, edm::ParameterSet::dump(), EGamma_, EmSource_, edm::ParameterSet::getParameter(), Jet_, JetSource_, LogDebug, Muon_, MuonSource_, and sourceTag_.

00059                                                                   :
00060   EGamma_(false), Muon_(false), Jet_(false), Candidate_(false), All_(false){
00061   const std::string category = "EcalRawToRecHit|RoI";
00062 
00063   sourceTag_=pset.getParameter<edm::InputTag>("sourceTag");
00064 
00065   std::string type = pset.getParameter<std::string>("type");
00066 
00067   if (type.find("candidate")!=std::string::npos){
00068     LogDebug(category)<<"configured for candidate-versatile input.";
00069     Candidate_ = true;
00070     std::vector<edm::ParameterSet> emPSet =  pset.getParameter<std::vector<edm::ParameterSet> >("CandJobPSet");
00071     for (std::vector<edm::ParameterSet>::iterator iepset = emPSet.begin(); iepset!=emPSet.end();++iepset){
00072       CandSource_.push_back(CandJobPSet(*iepset));
00073       LogDebug(category)<<iepset->dump();
00074     }
00075   }
00076   
00077   if (type.find("muon")!=std::string::npos){
00078     LogDebug(category)<<"configured for L1MuonParticleCollection input.";
00079     Muon_ = true;
00080     edm::ParameterSet ps = pset.getParameter<edm::ParameterSet>("MuJobPSet");
00081     MuonSource_ = MuJobPSet(ps);
00082     LogDebug(category)<<ps.dump();
00083   }
00084   
00085   if (type.find("egamma")!=std::string::npos){
00086     LogDebug(category)<<"configured for L1EMParticleCollection input.";
00087     EGamma_ = true;
00088     std::vector<edm::ParameterSet> emPSet =  pset.getParameter<std::vector<edm::ParameterSet> >("EmJobPSet");
00089     for (std::vector<edm::ParameterSet>::iterator iepset = emPSet.begin(); iepset!=emPSet.end();++iepset){
00090       EmSource_.push_back(EmJobPSet(*iepset));
00091       LogDebug(category)<<iepset->dump();
00092     }
00093   }
00094   
00095   if (type.find("jet")!=std::string::npos){
00096     LogDebug(category)<<"configured for L1JetParticleCollection input.";
00097     Jet_ =true;
00098     std::vector<edm::ParameterSet> jetPSet = pset.getParameter<std::vector<edm::ParameterSet> >("JetJobPSet");
00099     for (std::vector<edm::ParameterSet>::iterator ijpset = jetPSet.begin(); ijpset!=jetPSet.end();++ijpset){
00100       JetSource_.push_back(JetJobPSet(*ijpset));
00101       LogDebug(category)<<ijpset->dump();
00102     }
00103   }
00104 
00105   if (type.find("all")!=std::string::npos){
00106     LogDebug(category)<<"configured for ALL feds unpacking";
00107     All_ = true;
00108   }
00109 
00110   if (!All_ && !Muon_ && !EGamma_ && !Jet_ && !Candidate_){
00111     edm::LogError(category)<<"I have no specified type of work."
00112                                        <<"\nI will produce empty list of FEDs."
00113                                        <<"\nI will produce an empty EcalRecHitRefGetter."
00114                                        <<"\n I am sure you don't want that.";
00115     //throw. this is a typo/omittion in a cfg.
00116   }
00117 
00118  produces<EcalListOfFEDS>();
00119  produces<EcalRecHitRefGetter>();
00120 }

EcalRawToRecHitRoI::~EcalRawToRecHitRoI (  )  [virtual]

Definition at line 124 of file EcalRawToRecHitRoI.cc.

00124                                         {
00125 }


Member Function Documentation

void EcalRawToRecHitRoI::beginJob ( const edm::EventSetup c  )  [virtual]

Reimplemented from edm::EDProducer.

Definition at line 128 of file EcalRawToRecHitRoI.cc.

00128                                                        {
00129 }

void EcalRawToRecHitRoI::Cand ( edm::Event e,
const edm::EventSetup es,
std::vector< int > &  FEDs 
) [private]

Definition at line 212 of file EcalRawToRecHitRoI.cc.

References EcalRawToRecHitRoI::CandJobPSet::candidate, CandSource_, category, EcalRawToRecHitRoI::CandJobPSet::chargedcandidate, dumpFEDs(), EcalRawToRecHitRoI::CandJobPSet::l1jet, EcalRawToRecHitRoI::CandJobPSet::l1muon, LogDebug, unique(), and EcalRawToRecHitRoI::CandJobPSet::view.

Referenced by produce().

00212                                                                                           {
00213   const std::string category ="EcalRawToRecHit|Cand";
00214   
00215   uint nc=CandSource_.size();
00216   for (uint ic=0;ic!=nc;++ic){
00217     switch (CandSource_[ic].cType){
00218     case CandJobPSet::view :
00219       OneCandCollection< edm::View<reco::Candidate> >(e, es, CandSource_[ic], FEDs);
00220       break;
00221       
00222     case CandJobPSet::candidate :
00223       OneCandCollection<reco::CandidateCollection>(e, es, CandSource_[ic], FEDs);
00224       break;
00225 
00226     case CandJobPSet::chargedcandidate :
00227       OneCandCollection<reco::RecoChargedCandidateCollection>(e, es, CandSource_[ic], FEDs);
00228       break;
00229 
00230     case CandJobPSet::l1muon :
00231       OneCandCollection<L1MuonParticleCollection>(e, es, CandSource_[ic], FEDs);
00232       break;
00233 
00234     case CandJobPSet::l1jet :
00235       OneCandCollection<L1JetParticleCollection>(e, es, CandSource_[ic], FEDs);
00236       break;
00237       
00238     default:
00239       edm::LogError(category)<<"cType not recognised: "<<CandSource_[ic].cType;
00240     }
00241   }
00242 
00243   unique(FEDs);
00244   LogDebug(category)<<"unpack FED\n"<<dumpFEDs(FEDs);
00245 }

std::string EcalRawToRecHitRoI::dumpFEDs ( const std::vector< int > &  FEDs  )  [private]

Definition at line 135 of file EcalRawToRecHitRoI.cc.

References i, and ss.

Referenced by Cand(), Egamma(), Jet(), ListOfFEDS(), Muon(), and produce().

00135                                                                  {
00136   std::stringstream ss;
00137   ss<<"unpack FED: ";
00138   for (uint i=0; i < FEDs.size(); i++) {
00139     ss<< FEDs[i] << ((i!= FEDs.size()-1)? ", ":"\n");
00140   }
00141   ss<< "Number of FEDS is " << FEDs.size();
00142   return ss.str();
00143 }

void EcalRawToRecHitRoI::Egamma ( edm::Event e,
const edm::EventSetup es,
std::vector< int > &  FEDs 
) [private]

Definition at line 270 of file EcalRawToRecHitRoI.cc.

References category, dumpFEDs(), Egamma_OneL1EmCollection(), emColl, EmSource_, edm::EventSetup::get(), edm::Event::getByLabel(), edm::Handle< T >::isValid(), LogDebug, and unique().

Referenced by produce().

00270                                                                                             {
00271   const std::string category = "EcalRawToRecHit|Egamma";
00272   
00273   LogDebug(category)<< " enter in EcalRawToRecHitRoI::Egamma";
00274   
00275   // Get the CaloGeometry
00276   edm::ESHandle<L1CaloGeometry> l1CaloGeom ;
00277   es.get<L1CaloGeometryRecord>().get(l1CaloGeom) ;
00278 
00279   edm::Handle< l1extra::L1EmParticleCollection > emColl;
00280   uint ne=EmSource_.size();
00281   for (uint ie=0;ie!=ne;++ie){
00282     e.getByLabel(EmSource_[ie].Source,emColl);
00283     if (!emColl.isValid()){edm::LogError(category)<<"L1Em Collection: "<<EmSource_[ie].Source<<" is not valid.";continue;}
00284 
00285     Egamma_OneL1EmCollection(emColl,EmSource_[ie],l1CaloGeom,FEDs);
00286   }
00287 
00288   unique(FEDs);
00289   LogDebug(category)<<"end of get list of feds\n"<<dumpFEDs(FEDs);
00290   return;
00291 }

void EcalRawToRecHitRoI::Egamma_OneL1EmCollection ( const edm::Handle< l1extra::L1EmParticleCollection emColl,
const EmJobPSet ejpset,
const edm::ESHandle< L1CaloGeometry > &  l1CaloGeom,
std::vector< int > &  FEDs 
) [private]

process one collection of L1Em

Definition at line 247 of file EcalRawToRecHitRoI.cc.

References category, ListOfFEDS(), LogDebug, EcalRawToRecHitRoI::CalUnpackJobPSet::Ptmin, EcalRawToRecHitRoI::CalUnpackJobPSet::regionEtaMargin, and EcalRawToRecHitRoI::CalUnpackJobPSet::regionPhiMargin.

Referenced by Egamma().

00250                                                                         {
00251   const   std::string category = "EcalRawToRecHit|Egamma";
00252   for( l1extra::L1EmParticleCollection::const_iterator emItr = emColl->begin();
00253        emItr != emColl->end() ;++emItr ){
00254     float pt = emItr -> pt();
00255     if (pt < ejpset.Ptmin ) continue;
00256     LogDebug(category)<<" Here is an L1 isoEM candidate of pt " << pt;
00257     // Access the GCT hardware object corresponding to the L1Extra EM object.
00258     int etaIndex = emItr->gctEmCand()->etaIndex() ;
00259     int phiIndex = emItr->gctEmCand()->phiIndex() ;
00260     // Use the L1CaloGeometry to find the eta, phi bin boundaries.
00261     double etaLow  = l1CaloGeom->etaBinLowEdge( etaIndex ) ;
00262     double etaHigh = l1CaloGeom->etaBinHighEdge( etaIndex ) ;
00263     double phiLow  = l1CaloGeom->emJetPhiBinLowEdge( phiIndex ) ;
00264     double phiHigh = l1CaloGeom->emJetPhiBinHighEdge( phiIndex ) ;
00265     
00266     ListOfFEDS(etaLow, etaHigh, phiLow, phiHigh, ejpset.regionEtaMargin, ejpset.regionPhiMargin,FEDs);
00267   }
00268 }

void EcalRawToRecHitRoI::endJob ( void   )  [virtual]

Reimplemented from edm::EDProducer.

Definition at line 131 of file EcalRawToRecHitRoI.cc.

00131                                {
00132 }

void EcalRawToRecHitRoI::Jet ( edm::Event e,
const edm::EventSetup es,
std::vector< int > &  FEDs 
) [private]

Definition at line 340 of file EcalRawToRecHitRoI.cc.

References category, dumpFEDs(), edm::Event::getByLabel(), edm::Handle< T >::isValid(), Jet_OneL1JetCollection(), jetColl, JetSource_, LogDebug, and unique().

Referenced by produce().

00340                                                                                         {
00341   const std::string category = "EcalRawToRecHit|Jet";
00342 
00343   edm::Handle<L1JetParticleCollection> jetColl;
00344   uint nj=JetSource_.size();
00345   for (uint ij=0;ij!=nj;++ij){
00346     e.getByLabel(JetSource_[ij].Source,jetColl);
00347     if (!jetColl.isValid()){edm::LogError(category)<<"L1Jet collection: "<<JetSource_[ij].Source<<" is not valid.";continue;}
00348 
00349     Jet_OneL1JetCollection(jetColl,JetSource_[ij],FEDs);
00350   }
00351 
00352   unique(FEDs);
00353   LogDebug(category)<<"unpack FED\n"<<dumpFEDs(FEDs);
00354 }

void EcalRawToRecHitRoI::Jet_OneL1JetCollection ( const edm::Handle< l1extra::L1JetParticleCollection jetColl,
const JetJobPSet jjpset,
std::vector< int > &  feds 
) [private]

process on collection of L1Jets

Definition at line 322 of file EcalRawToRecHitRoI.cc.

References category, EcalRawToRecHitRoI::JetJobPSet::epsilon, eta, it, ListOfFEDS(), LogDebug, phi, EcalRawToRecHitRoI::CalUnpackJobPSet::Ptmin, EcalRawToRecHitRoI::CalUnpackJobPSet::regionEtaMargin, and EcalRawToRecHitRoI::CalUnpackJobPSet::regionPhiMargin.

Referenced by Jet().

00324                                                                       {
00325   const std::string category ="EcalRawToRecHit|Jet";
00326   for (L1JetParticleCollection::const_iterator it=jetColl->begin(); it != jetColl->end(); it++) {
00327     double pt    =  it -> pt();
00328     double eta   =  it -> eta();
00329     double phi   =  it -> phi();
00330 
00331     LogDebug(category) << " here is a L1 CentralJet Seed  with (eta,phi) = "
00332                        << eta << " " << phi << " and pt " << pt;
00333 
00334     if (pt < jjpset.Ptmin ) continue;
00335 
00336     ListOfFEDS(eta, eta, phi-jjpset.epsilon, phi+jjpset.epsilon, jjpset.regionEtaMargin, jjpset.regionPhiMargin,feds);
00337   }
00338 }

void EcalRawToRecHitRoI::ListOfFEDS ( double  etaLow,
double  etaHigh,
double  phiLow,
double  phiHigh,
double  etamargin,
double  phimargin,
std::vector< int > &  FEDs 
) [private]

actually fill the vector with FED numbers

Definition at line 359 of file EcalRawToRecHitRoI.cc.

References python::cmstools::all(), category, dd, dumpFEDs(), LogDebug, Geom::pi(), and TheMapping.

Referenced by Egamma_OneL1EmCollection(), Jet_OneL1JetCollection(), Muon(), and OneCandCollection().

00362 {
00363   const std::string category = "EcalRawToRecHit|ListOfFEDS";
00364   
00365   if (phimargin > Geom::pi()) phimargin =  Geom::pi() ;
00366 
00367   
00368   LogDebug(category)<< " etaLow etaHigh phiLow phiHigh " << etaLow << " "
00369                     <<etaHigh << " " << phiLow << " " << phiHigh;
00370 
00371   
00372   etaLow -= etamargin;
00373   etaHigh += etamargin;
00374   double phiMinus = phiLow - phimargin;
00375   double phiPlus = phiHigh + phimargin;
00376   
00377   bool all = false;
00378   double dd = fabs(phiPlus-phiMinus);
00379   LogDebug(category)<< " dd = " << dd;
00380   if (dd > 2.*Geom::pi() ) all = true;
00381 
00382   while (phiPlus > Geom::pi()) { phiPlus -= 2.*Geom::pi() ; }
00383   while (phiMinus < 0) { phiMinus += 2.*Geom::pi() ; }
00384   if ( phiMinus > Geom::pi()) phiMinus -= 2.*Geom::pi() ;
00385 
00386   double dphi = phiPlus - phiMinus;
00387   if (dphi < 0) dphi += 2.*Geom::pi() ;
00388   LogDebug(category) << "dphi = " << dphi;
00389   if (dphi > Geom::pi()) {
00390     int fed_low1 = TheMapping -> GetFED(etaLow,phiMinus*180./Geom::pi());
00391     int fed_low2 = TheMapping -> GetFED(etaLow,phiPlus*180./Geom::pi());
00392     LogDebug(category) << "fed_low1 fed_low2 " << fed_low1 << " " << fed_low2;
00393     if (fed_low1 == fed_low2) all = true;
00394     int fed_hi1 = TheMapping -> GetFED(etaHigh,phiMinus*180./Geom::pi());
00395     int fed_hi2 = TheMapping -> GetFED(etaHigh,phiPlus*180./Geom::pi());
00396     LogDebug(category) << "fed_hi1 fed_hi2 " << fed_hi1 << " " << fed_hi2;
00397     if (fed_hi1 == fed_hi2) all = true;
00398   }
00399 
00400 
00401   if (all) {
00402     LogDebug(category)<< " unpack everything in phi ! ";
00403     phiMinus = -20 * Geom::pi() / 180.;  // -20 deg
00404     phiPlus = -40 * Geom::pi() / 180.;  // -20 deg
00405   }
00406   
00407   LogDebug(category) << " with margins : " << etaLow << " " << etaHigh << " "
00408                      << phiMinus << " " << phiPlus;
00409 
00410 
00411   const EcalEtaPhiRegion ecalregion(etaLow,etaHigh,phiMinus,phiPlus);
00412 
00413   TheMapping -> GetListofFEDs(ecalregion, FEDs);
00414   LogDebug(category)<<"unpack fed:\n"<<dumpFEDs(FEDs);
00415 
00416 }

void EcalRawToRecHitRoI::Muon ( edm::Event e,
const edm::EventSetup es,
std::vector< int > &  FEDs 
) [private]

Definition at line 294 of file EcalRawToRecHitRoI.cc.

References category, dumpFEDs(), EcalRawToRecHitRoI::MuJobPSet::epsilon, eta, edm::Event::getByLabel(), it, ListOfFEDS(), LogDebug, MuonSource_, phi, EcalRawToRecHitRoI::CalUnpackJobPSet::Ptmin, EcalRawToRecHitRoI::CalUnpackJobPSet::regionEtaMargin, EcalRawToRecHitRoI::CalUnpackJobPSet::regionPhiMargin, EcalRawToRecHitRoI::CalUnpackJobPSet::Source, and unique().

Referenced by produce().

00294                                                                                         {
00295   const std::string category = "EcalRawToRecHit|Muon";
00296 
00297   LogDebug(category)<< " enter in EcalRawToRecHitRoI::Muon";
00298 
00299   edm::Handle<L1MuonParticleCollection> muColl;
00300   e.getByLabel(MuonSource_.Source, muColl);
00301 
00302   for (L1MuonParticleCollection::const_iterator it=muColl->begin(); it != muColl->end(); it++) {
00303 
00304     const L1MuGMTExtendedCand muonCand = (*it).gmtMuonCand();
00305     double pt    =  (*it).pt();
00306     double eta   =  (*it).eta();
00307     double phi   =  (*it).phi();
00308 
00309     LogDebug(category)<<" here is a L1 muon Seed  with (eta,phi) = " 
00310                       <<eta << " " << phi << " and pt " << pt;
00311     if (pt < MuonSource_.Ptmin) continue;
00312 
00313     ListOfFEDS(eta, eta, phi-MuonSource_.epsilon, phi+MuonSource_.epsilon, MuonSource_.regionEtaMargin, MuonSource_.regionPhiMargin,FEDs);
00314   }
00315   
00316   unique(FEDs);
00317   LogDebug(category)<<"end of get list of feds\n"<<dumpFEDs(FEDs);
00318   
00319   return;
00320 }

template<typename CollectionType>
void EcalRawToRecHitRoI::OneCandCollection ( const edm::Event e,
const edm::EventSetup es,
const CandJobPSet cjpset,
std::vector< int > &  feds 
) [inline, private]

process one collection of Candidate-versatile objects

Definition at line 164 of file EcalRawToRecHitRoI.h.

References EcalRawToRecHitRoI::CandJobPSet::bePrecise, category, EcalRawToRecHitRoI::CandJobPSet::cType, end, EcalRawToRecHitRoI::CandJobPSet::epsilon, eta, edm::Handle< T >::failedToGet(), edm::EventSetup::get(), edm::Event::getByLabel(), it, ListOfFEDS(), LogDebug, out, phi, edm::ESHandle< T >::product(), EcalRawToRecHitRoI::CandJobPSet::propagatorNameToBePrecise, EcalRawToRecHitRoI::CalUnpackJobPSet::Ptmin, EcalRawToRecHitRoI::CalUnpackJobPSet::regionEtaMargin, EcalRawToRecHitRoI::CalUnpackJobPSet::regionPhiMargin, and EcalRawToRecHitRoI::CalUnpackJobPSet::Source.

00167                                                                                                     {
00168   const std::string category ="EcalRawToRecHit|Cand";
00169   
00170   edm::Handle<CollectionType> candColl;
00171   e.getByLabel(cjpset.Source, candColl);
00172   if (candColl.failedToGet()) {edm::LogError(category)<<"could not get: "<<cjpset.Source<<" of type: "<<cjpset.cType; return;}
00173 
00174   typename CollectionType::const_iterator it = candColl->begin();
00175   typename CollectionType::const_iterator end= candColl->end();
00176 
00177   StateOnTrackerBound * onBounds=0;
00178   edm::ESHandle<Propagator> propH;
00179   if (cjpset.bePrecise){
00180     //      grab a propagator from ES
00181     es.get<TrackingComponentsRecord>().get(cjpset.propagatorNameToBePrecise, propH);
00182     //      make the extrapolator object
00183     onBounds = new StateOnTrackerBound(propH.product());
00184   }
00185   
00186   for (; it!=end;++it){
00187     double pt    =  it->pt();
00188     double eta   =  it->eta();
00189     double phi   =  it->phi();
00190     if (cjpset.bePrecise){
00191       //      starting FTS
00192       GlobalPoint point(it->vx(),it->vy(),it->vz());
00193       GlobalVector vector(it->px(),it->py(),it->pz());
00194 
00195       if (point.mag()==0 && vector.mag()==0){
00196         edm::LogWarning(category)<<" state of candidate is not valid. skipping.";
00197         continue;
00198       }
00199 
00200       FreeTrajectoryState fts(point, vector, it->charge(), propH->magneticField());
00201       //      final TSOS
00202       TrajectoryStateOnSurface out = (*onBounds)(fts);
00203       if (out.isValid()){
00204         vector=out.globalMomentum();
00205         point=out.globalPosition();
00206         //      be more precise
00207         pt= vector.perp();
00208         eta= point.eta();
00209         phi= point.phi();
00210       }
00211       else{edm::LogError(category)<<"I tried to be precise, but propagation failed. from:\n"<<fts;
00212         continue;}
00213     }
00214     
00215     LogDebug(category)<<" here is a candidate Seed  with (eta,phi) = " 
00216                       <<eta << " " << phi << " and pt " << pt;
00217     if (pt < cjpset.Ptmin) continue;
00218     
00219     ListOfFEDS(eta, eta, phi-cjpset.epsilon, phi+cjpset.epsilon, cjpset.regionEtaMargin, cjpset.regionPhiMargin,feds);
00220   }
00221   if(cjpset.bePrecise){delete onBounds;}
00222 }

void EcalRawToRecHitRoI::produce ( edm::Event e,
const edm::EventSetup c 
) [virtual]

Implements edm::EDProducer.

Definition at line 145 of file EcalRawToRecHitRoI.cc.

References All_, Cand(), Candidate_, category, dumpFEDs(), Egamma(), EGamma_, edm::EventSetup::get(), edm::Event::getByLabel(), FEDNumbering::getEcalFEDIds(), i, edm::Event::id(), Jet(), Jet_, MyWatcher::lap(), LogDebug, Muon(), Muon_, edm::Event::put(), sourceTag_, and TheMapping.

00145                                                                          {
00146   const std::string category = "EcalRawToRecHit|RoI";
00147   MyWatcher watcher("RoI");
00148   LogDebug(category)<<watcher.lap();
00149 
00150   // retreive cabling
00151   edm::ESHandle<EcalRegionCabling> cabling;
00152   iSetup.get<EcalRegionCablingRecord>().get(cabling);
00153   LogDebug(category)<<"cabling retrieved."
00154                     <<watcher.lap();
00155   TheMapping =cabling->mapping();
00156 
00157   std::pair<int,int> ecalfeds = FEDNumbering::getEcalFEDIds();
00158   int first_fed = ecalfeds.first;
00159   
00160   std::auto_ptr<EcalListOfFEDS> productAddress(new EcalListOfFEDS);
00161   std::vector<int> feds;                // the list of FEDS produced by this module
00162 
00163  if (EGamma_) {   Egamma(e, iSetup, feds); }
00164 
00165  if (Muon_) {   Muon(e, iSetup, feds); }
00166 
00167  if (Jet_) {   Jet(e, iSetup, feds); }
00168 
00169  if (Candidate_) { Cand(e, iSetup, feds); }
00170 
00171  if (All_)  {   for (int i=1; i <= 54; feds.push_back(i++)){} }
00172  
00173  uint nf = feds.size();
00174  for (uint i=0; i <nf; feds[i++]+=first_fed) {}
00175  
00176  LogDebug(category)<< "Will unpack FED\n" <<dumpFEDs(feds)
00177                    <<watcher.lap();
00178  
00179  if (nf<1){edm::LogWarning(category)<<"no ECAL FED to unpack for Run " << e.id().run() << "  Event " << e.id().event() ;}
00180  
00181  productAddress->SetList(feds);
00182  e.put(productAddress);
00183  LogDebug(category)<< "list of fed put in the event."
00184                    <<watcher.lap();
00185  
00186  //now defined the Region of interest to be unpacked. from the feds list
00187 
00188  
00189  //get the lazy gettter
00190  edm::Handle<EcalRecHitLazyGetter> lgetter;
00191  e.getByLabel(sourceTag_, lgetter);
00192  LogDebug(category)<<"lazy getter retrieved from: "<<sourceTag_
00193                    <<watcher.lap();
00194  
00195  //prepare a refgetter
00196  std::auto_ptr<EcalRecHitRefGetter> rgetter(new EcalRecHitRefGetter);
00197  LogDebug(category)<<"ref getter ready to be updated."
00198                                 <<watcher.lap();
00199  
00200  for (uint i=0;i!=nf;i++){
00201    cabling->updateEcalRefGetterWithFedIndex(*rgetter, lgetter, feds[i]);  
00202  }
00203  
00204  //put the refgetter in the event  
00205  LogDebug(category)<<"refGetter to be put in the event."
00206                    << watcher.lap();
00207  e.put(rgetter);
00208  LogDebug(category)<<"refGetter loaded."
00209                                 << watcher.lap();
00210 }

void EcalRawToRecHitRoI::unique ( std::vector< int > &  FEDs  )  [inline, private]

remove duplicates

Definition at line 157 of file EcalRawToRecHitRoI.h.

References python::multivaluedict::sort().

Referenced by Cand(), Egamma(), Jet(), and Muon().

00157                                          {
00158           std::sort(FEDs.begin(),FEDs.end());
00159           std::vector<int>::iterator n_end = std::unique(FEDs.begin(),FEDs.end());
00160           FEDs.erase(n_end,FEDs.end());}


Member Data Documentation

bool EcalRawToRecHitRoI::All_ [private]

if all need to be done

Definition at line 149 of file EcalRawToRecHitRoI.h.

Referenced by EcalRawToRecHitRoI(), and produce().

bool EcalRawToRecHitRoI::Candidate_ [private]

Candidate-versatile objects part flag.

Definition at line 127 of file EcalRawToRecHitRoI.h.

Referenced by EcalRawToRecHitRoI(), and produce().

std::vector< CandJobPSet > EcalRawToRecHitRoI::CandSource_ [private]

what drives the job from candidate

Definition at line 146 of file EcalRawToRecHitRoI.h.

Referenced by Cand(), and EcalRawToRecHitRoI().

bool EcalRawToRecHitRoI::EGamma_ [private]

Egamma part flag.

Definition at line 82 of file EcalRawToRecHitRoI.h.

Referenced by EcalRawToRecHitRoI(), and produce().

std::vector< EmJobPSet > EcalRawToRecHitRoI::EmSource_ [private]

what drive the job on L1Em collection

Definition at line 95 of file EcalRawToRecHitRoI.h.

Referenced by EcalRawToRecHitRoI(), and Egamma().

bool EcalRawToRecHitRoI::Jet_ [private]

jet part flag

Definition at line 111 of file EcalRawToRecHitRoI.h.

Referenced by EcalRawToRecHitRoI(), and produce().

std::vector< JetJobPSet > EcalRawToRecHitRoI::JetSource_ [private]

what drive the job on L1Jet collection

Definition at line 124 of file EcalRawToRecHitRoI.h.

Referenced by EcalRawToRecHitRoI(), and Jet().

bool EcalRawToRecHitRoI::Muon_ [private]

Muon part flag.

Definition at line 98 of file EcalRawToRecHitRoI.h.

Referenced by EcalRawToRecHitRoI(), and produce().

MuJobPSet EcalRawToRecHitRoI::MuonSource_ [private]

what drives the job from ONE L1Muon collection

Definition at line 108 of file EcalRawToRecHitRoI.h.

Referenced by EcalRawToRecHitRoI(), and Muon().

edm::InputTag EcalRawToRecHitRoI::sourceTag_ [private]

input tag for the lazy getter

Definition at line 60 of file EcalRawToRecHitRoI.h.

Referenced by EcalRawToRecHitRoI(), and produce().

const EcalElectronicsMapping* EcalRawToRecHitRoI::TheMapping [private]

tools

Definition at line 63 of file EcalRawToRecHitRoI.h.

Referenced by ListOfFEDS(), and produce().


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