CMS 3D CMS Logo

Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes

EcalRawToRecHitRoI Class Reference

#include <EcalRawToRecHitRoI.h>

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

List of all members.

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...

Public Member Functions

 EcalRawToRecHitRoI (const edm::ParameterSet &pset)
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 do_es_
bool EGamma_
 Egamma part flag.
std::vector< EmJobPSetEmSource_
 what drive the job on L1Em collection
std::string esinstance_
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
edm::InputTag sourceTag_es_
const ESElectronicsMapperTheESMapping
const EcalElectronicsMappingTheMapping
 tools

Detailed Description

Definition at line 39 of file EcalRawToRecHitRoI.h.


Member Typedef Documentation

Definition at line 41 of file EcalRawToRecHitRoI.h.

Definition at line 42 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_, python::rootplot::argparse::category, do_es_, edm::ParameterSet::dump(), EGamma_, EmSource_, esinstance_, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), Jet_, JetSource_, LogDebug, Muon_, MuonSource_, sourceTag_, sourceTag_es_, and AlCaHLTBitMon_QueryRunRegistry::string.

                                                                  :
  EGamma_(false), Muon_(false), Jet_(false), Candidate_(false), All_(false){
  const std::string category = "EcalRawToRecHit|RoI";

  sourceTag_=pset.getParameter<edm::InputTag>("sourceTag");

  std::string type = pset.getParameter<std::string>("type");

  if (type.find("candidate")!=std::string::npos){
    LogDebug(category)<<"configured for candidate-versatile input.";
    Candidate_ = true;
    std::vector<edm::ParameterSet> emPSet =  pset.getParameter<std::vector<edm::ParameterSet> >("CandJobPSet");
    for (std::vector<edm::ParameterSet>::iterator iepset = emPSet.begin(); iepset!=emPSet.end();++iepset){
      CandSource_.push_back(CandJobPSet(*iepset));
      LogDebug(category)<<iepset->dump();
    }
  }
  
  if (type.find("muon")!=std::string::npos){
    LogDebug(category)<<"configured for L1MuonParticleCollection input.";
    Muon_ = true;
    edm::ParameterSet ps = pset.getParameter<edm::ParameterSet>("MuJobPSet");
    MuonSource_ = MuJobPSet(ps);
    LogDebug(category)<<ps.dump();
  }
  
  if (type.find("egamma")!=std::string::npos){
    LogDebug(category)<<"configured for L1EMParticleCollection input.";
    EGamma_ = true;
    std::vector<edm::ParameterSet> emPSet =  pset.getParameter<std::vector<edm::ParameterSet> >("EmJobPSet");
    for (std::vector<edm::ParameterSet>::iterator iepset = emPSet.begin(); iepset!=emPSet.end();++iepset){
      EmSource_.push_back(EmJobPSet(*iepset));
      LogDebug(category)<<iepset->dump();
    }
  }
  
  if (type.find("jet")!=std::string::npos){
    LogDebug(category)<<"configured for L1JetParticleCollection input.";
    Jet_ =true;
    std::vector<edm::ParameterSet> jetPSet = pset.getParameter<std::vector<edm::ParameterSet> >("JetJobPSet");
    for (std::vector<edm::ParameterSet>::iterator ijpset = jetPSet.begin(); ijpset!=jetPSet.end();++ijpset){
      JetSource_.push_back(JetJobPSet(*ijpset));
      LogDebug(category)<<ijpset->dump();
    }
  }

  if (type.find("all")!=std::string::npos){
    LogDebug(category)<<"configured for ALL feds unpacking";
    All_ = true;
  }

  if (!All_ && !Muon_ && !EGamma_ && !Jet_ && !Candidate_){
    edm::LogError("IncorrectConfiguration")<<"I have no specified type of work."
                                       <<"\nI will produce empty list of FEDs."
                                       <<"\nI will produce an empty EcalRecHitRefGetter."
                                       <<"\n I am sure you don't want that.";
    //throw. this is a typo/omittion in a cfg.
  }

  produces<EcalListOfFEDS>();
  produces<EcalRecHitRefGetter>();

  if (pset.exists("doES"))
    do_es_ = pset.getParameter<bool>("doES");
  else
    do_es_ = false;
  
  if (do_es_) {
    LogDebug(category)<<"will also make the list of FEDs for the ES.";
    sourceTag_es_=pset.getParameter<edm::InputTag>("sourceTag_es");
    esinstance_=pset.getUntrackedParameter<std::string>("esInstance","es");
    if (esinstance_=="")
      edm::LogError("IncorrectConfiguration")<<" instance name for ES region and FED list cannot be empty. expect a fwk failure.";
    produces<ESListOfFEDS>(esinstance_);
    produces<EcalRecHitRefGetter>(esinstance_);
  }
}
EcalRawToRecHitRoI::~EcalRawToRecHitRoI ( ) [virtual]

Definition at line 139 of file EcalRawToRecHitRoI.cc.

                                        {
}

Member Function Documentation

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

Definition at line 275 of file EcalRawToRecHitRoI.cc.

References EcalRawToRecHitRoI::CandJobPSet::candidate, CandSource_, python::rootplot::argparse::category, EcalRawToRecHitRoI::CandJobPSet::chargedcandidate, dumpFEDs(), alignCSCRings::e, reco_application_2006h2rawdata_ecalLocalReco_cfg::FEDs, EcalRawToRecHitRoI::CandJobPSet::l1jet, EcalRawToRecHitRoI::CandJobPSet::l1muon, LogDebug, AlCaHLTBitMon_QueryRunRegistry::string, unique(), and EcalRawToRecHitRoI::CandJobPSet::view.

Referenced by produce().

                                                                                          {
  const std::string category ="EcalRawToRecHit|Cand";
  
  unsigned int nc=CandSource_.size();
  for (unsigned int ic=0;ic!=nc;++ic){
    switch (CandSource_[ic].cType){
    case CandJobPSet::view :
      OneCandCollection< edm::View<reco::Candidate> >(e, es, CandSource_[ic], FEDs);
      break;
      
    case CandJobPSet::candidate :
      OneCandCollection<reco::CandidateCollection>(e, es, CandSource_[ic], FEDs);
      break;

    case CandJobPSet::chargedcandidate :
      OneCandCollection<reco::RecoChargedCandidateCollection>(e, es, CandSource_[ic], FEDs);
      break;

    case CandJobPSet::l1muon :
      OneCandCollection<L1MuonParticleCollection>(e, es, CandSource_[ic], FEDs);
      break;

    case CandJobPSet::l1jet :
      OneCandCollection<L1JetParticleCollection>(e, es, CandSource_[ic], FEDs);
      break;
      
    default:
      edm::LogError("IncorrectRecHit")<<"cType not recognised: "<<CandSource_[ic].cType;
    }
  }

  unique(FEDs);
  LogDebug(category)<<"unpack FED\n"<<dumpFEDs(FEDs);
}
std::string EcalRawToRecHitRoI::dumpFEDs ( const std::vector< int > &  FEDs) [private]

Definition at line 145 of file EcalRawToRecHitRoI.cc.

References i.

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

                                                                 {
  std::stringstream ss;
  ss<<"unpack FED: ";
  for (unsigned int i=0; i < FEDs.size(); i++) {
    ss<< FEDs[i] << ((i!= FEDs.size()-1)? ", ":"\n");
  }
  ss<< "Number of FEDS is " << FEDs.size();
  return ss.str();
}
void EcalRawToRecHitRoI::Egamma ( edm::Event e,
const edm::EventSetup es,
std::vector< int > &  FEDs 
) [private]

Definition at line 333 of file EcalRawToRecHitRoI.cc.

References python::rootplot::argparse::category, dumpFEDs(), Egamma_OneL1EmCollection(), EmSource_, edm::EventSetup::get(), edm::Event::getByLabel(), edm::HandleBase::isValid(), LogDebug, Vispa::Plugins::EdmBrowser::EdmDataAccessor::ne(), popcon_last_value_cfg::Source, AlCaHLTBitMon_QueryRunRegistry::string, and unique().

Referenced by produce().

                                                                                            {
  const std::string category = "EcalRawToRecHit|Egamma";
  
  LogDebug(category)<< " enter in EcalRawToRecHitRoI::Egamma";
  
  // Get the CaloGeometry
  edm::ESHandle<L1CaloGeometry> l1CaloGeom ;
  es.get<L1CaloGeometryRecord>().get(l1CaloGeom) ;

  edm::Handle< l1extra::L1EmParticleCollection > emColl;
  unsigned int ne=EmSource_.size();
  for (unsigned int ie=0;ie!=ne;++ie){
    e.getByLabel(EmSource_[ie].Source,emColl);
    if (!emColl.isValid()){edm::LogError("IncorrectConfiguration")<<"L1Em Collection: "<<EmSource_[ie].Source<<" is not valid.";continue;}

    Egamma_OneL1EmCollection(emColl,EmSource_[ie],l1CaloGeom,FEDs);
  }

  unique(FEDs);
  LogDebug(category)<<"end of get list of feds\n"<<dumpFEDs(FEDs);
  return;
}
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 310 of file EcalRawToRecHitRoI.cc.

References python::rootplot::argparse::category, ListOfFEDS(), LogDebug, EcalRawToRecHitRoI::CalUnpackJobPSet::Ptmin, EcalRawToRecHitRoI::CalUnpackJobPSet::regionEtaMargin, EcalRawToRecHitRoI::CalUnpackJobPSet::regionPhiMargin, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by Egamma().

                                                                        {
  const   std::string category = "EcalRawToRecHit|Egamma";
  for( l1extra::L1EmParticleCollection::const_iterator emItr = emColl->begin();
       emItr != emColl->end() ;++emItr ){
    float pt = emItr -> pt();
    if (pt < ejpset.Ptmin ) continue;
    LogDebug(category)<<" Here is an L1 isoEM candidate of pt " << pt;
    // Access the GCT hardware object corresponding to the L1Extra EM object.
    int etaIndex = emItr->gctEmCand()->etaIndex() ;
    int phiIndex = emItr->gctEmCand()->phiIndex() ;
    // Use the L1CaloGeometry to find the eta, phi bin boundaries.
    double etaLow  = l1CaloGeom->etaBinLowEdge( etaIndex ) ;
    double etaHigh = l1CaloGeom->etaBinHighEdge( etaIndex ) ;
    double phiLow  = l1CaloGeom->emJetPhiBinLowEdge( phiIndex ) ;
    double phiHigh = l1CaloGeom->emJetPhiBinHighEdge( phiIndex ) ;
    
    ListOfFEDS(etaLow, etaHigh, phiLow, phiHigh, ejpset.regionEtaMargin, ejpset.regionPhiMargin,FEDs);
  }
}
void EcalRawToRecHitRoI::Jet ( edm::Event e,
const edm::EventSetup es,
std::vector< int > &  FEDs 
) [private]

Definition at line 408 of file EcalRawToRecHitRoI.cc.

References python::rootplot::argparse::category, dumpFEDs(), edm::Event::getByLabel(), edm::HandleBase::isValid(), Jet_OneL1JetCollection(), JetSource_, LogDebug, popcon_last_value_cfg::Source, AlCaHLTBitMon_QueryRunRegistry::string, and unique().

Referenced by produce().

                                                                                        {
  const std::string category = "EcalRawToRecHit|Jet";

  edm::Handle<L1JetParticleCollection> jetColl;
  unsigned int nj=JetSource_.size();
  for (unsigned int ij=0;ij!=nj;++ij){
    e.getByLabel(JetSource_[ij].Source,jetColl);
    if (!jetColl.isValid()) {
      edm::LogError("IncorrectConfiguration") << "L1Jet collection: " << JetSource_[ij].Source << " is not valid.";
      continue;
    }

    Jet_OneL1JetCollection(jetColl,JetSource_[ij],FEDs);
  }

  unique(FEDs);
  LogDebug(category)<<"unpack FED\n"<<dumpFEDs(FEDs);
}
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 390 of file EcalRawToRecHitRoI.cc.

References python::rootplot::argparse::category, EcalRawToRecHitRoI::JetJobPSet::epsilon, eta(), ListOfFEDS(), LogDebug, phi, EcalRawToRecHitRoI::CalUnpackJobPSet::Ptmin, EcalRawToRecHitRoI::CalUnpackJobPSet::regionEtaMargin, EcalRawToRecHitRoI::CalUnpackJobPSet::regionPhiMargin, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by Jet().

                                                                      {
  const std::string category ="EcalRawToRecHit|Jet";
  for (L1JetParticleCollection::const_iterator it=jetColl->begin(); it != jetColl->end(); it++) {
    double pt    =  it -> pt();
    double eta   =  it -> eta();
    double phi   =  it -> phi();

    LogDebug(category) << " here is a L1 CentralJet Seed  with (eta,phi) = "
                       << eta << " " << phi << " and pt " << pt;

    if (pt < jjpset.Ptmin ) continue;

    ListOfFEDS(eta, eta, phi-jjpset.epsilon, phi+jjpset.epsilon, jjpset.regionEtaMargin, jjpset.regionPhiMargin,feds);
  }
}
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 430 of file EcalRawToRecHitRoI.cc.

References cond::ecalcond::all, python::rootplot::argparse::category, createTree::dd, dumpFEDs(), LogDebug, Geom::pi(), pi, AlCaHLTBitMon_QueryRunRegistry::string, and TheMapping.

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

{
  const std::string category = "EcalRawToRecHit|ListOfFEDS";
  
  if (phimargin > Geom::pi()) phimargin =  Geom::pi() ;

  
  LogDebug(category)<< " etaLow etaHigh phiLow phiHigh " << etaLow << " "
                    <<etaHigh << " " << phiLow << " " << phiHigh;

  
  etaLow -= etamargin;
  etaHigh += etamargin;
  double phiMinus = phiLow - phimargin;
  double phiPlus = phiHigh + phimargin;
  
  bool all = false;
  double dd = fabs(phiPlus-phiMinus);
  LogDebug(category)<< " dd = " << dd;
  if (dd > 2.*Geom::pi() ) all = true;

  while (phiPlus > Geom::pi()) { phiPlus -= 2.*Geom::pi() ; }
  while (phiMinus < 0) { phiMinus += 2.*Geom::pi() ; }
  if ( phiMinus > Geom::pi()) phiMinus -= 2.*Geom::pi() ;

  double dphi = phiPlus - phiMinus;
  if (dphi < 0) dphi += 2.*Geom::pi() ;
  LogDebug(category) << "dphi = " << dphi;
  if (dphi > Geom::pi()) {
    int fed_low1 = TheMapping -> GetFED(etaLow,phiMinus*180./Geom::pi());
    int fed_low2 = TheMapping -> GetFED(etaLow,phiPlus*180./Geom::pi());
    LogDebug(category) << "fed_low1 fed_low2 " << fed_low1 << " " << fed_low2;
    if (fed_low1 == fed_low2) all = true;
    int fed_hi1 = TheMapping -> GetFED(etaHigh,phiMinus*180./Geom::pi());
    int fed_hi2 = TheMapping -> GetFED(etaHigh,phiPlus*180./Geom::pi());
    LogDebug(category) << "fed_hi1 fed_hi2 " << fed_hi1 << " " << fed_hi2;
    if (fed_hi1 == fed_hi2) all = true;
  }


  if (all) {
    LogDebug(category)<< " unpack everything in phi ! ";
    phiMinus = -20 * Geom::pi() / 180.;  // -20 deg
    phiPlus = -40 * Geom::pi() / 180.;  // -20 deg
  }
  
  LogDebug(category) << " with margins : " << etaLow << " " << etaHigh << " "
                     << phiMinus << " " << phiPlus;


  const EcalEtaPhiRegion ecalregion(etaLow,etaHigh,phiMinus,phiPlus);

  TheMapping -> GetListofFEDs(ecalregion, FEDs);
  LogDebug(category)<<"unpack fed:\n"<<dumpFEDs(FEDs);

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

Definition at line 357 of file EcalRawToRecHitRoI.cc.

References python::rootplot::argparse::category, dumpFEDs(), EcalRawToRecHitRoI::MuJobPSet::epsilon, eta(), edm::HandleBase::failedToGet(), edm::Event::getByLabel(), ListOfFEDS(), LogDebug, MuonSource_, phi, EcalRawToRecHitRoI::CalUnpackJobPSet::Ptmin, EcalRawToRecHitRoI::CalUnpackJobPSet::regionEtaMargin, EcalRawToRecHitRoI::CalUnpackJobPSet::regionPhiMargin, EcalRawToRecHitRoI::CalUnpackJobPSet::Source, AlCaHLTBitMon_QueryRunRegistry::string, and unique().

Referenced by produce().

                                                                                        {
  const std::string category = "EcalRawToRecHit|Muon";

  LogDebug(category)<< " enter in EcalRawToRecHitRoI::Muon";

  edm::Handle<L1MuonParticleCollection> muColl;
  e.getByLabel(MuonSource_.Source, muColl);
  if (muColl.failedToGet())
   {
     edm::LogError("IncorrectConfiguration")<<" could not retrieve the l1 muon collection from: "<<MuonSource_.Source;
     return;
   }

  for (L1MuonParticleCollection::const_iterator it=muColl->begin(); it != muColl->end(); it++) {

    const L1MuGMTExtendedCand muonCand = (*it).gmtMuonCand();
    double pt    =  (*it).pt();
    double eta   =  (*it).eta();
    double phi   =  (*it).phi();

    LogDebug(category)<<" here is a L1 muon Seed  with (eta,phi) = " 
                      <<eta << " " << phi << " and pt " << pt;
    if (pt < MuonSource_.Ptmin) continue;

    ListOfFEDS(eta, eta, phi-MuonSource_.epsilon, phi+MuonSource_.epsilon, MuonSource_.regionEtaMargin, MuonSource_.regionPhiMargin,FEDs);
  }
  
  unique(FEDs);
  LogDebug(category)<<"end of get list of feds\n"<<dumpFEDs(FEDs);
  
  return;
}
template<typename CollectionType >
void EcalRawToRecHitRoI::OneCandCollection ( const edm::Event e,
const edm::EventSetup es,
const CandJobPSet cjpset,
std::vector< int > &  feds 
) [private]

process one collection of Candidate-versatile objects

Definition at line 167 of file EcalRawToRecHitRoI.h.

References EcalRawToRecHitRoI::CandJobPSet::bePrecise, python::rootplot::argparse::category, EcalRawToRecHitRoI::CandJobPSet::cType, end, EcalRawToRecHitRoI::CandJobPSet::epsilon, eta(), edm::HandleBase::failedToGet(), edm::EventSetup::get(), edm::Event::getByLabel(), ListOfFEDS(), LogDebug, dbtoconf::out, phi, point, edm::ESHandle< T >::product(), EcalRawToRecHitRoI::CandJobPSet::propagatorNameToBePrecise, EcalRawToRecHitRoI::CalUnpackJobPSet::Ptmin, EcalRawToRecHitRoI::CalUnpackJobPSet::regionEtaMargin, EcalRawToRecHitRoI::CalUnpackJobPSet::regionPhiMargin, EcalRawToRecHitRoI::CalUnpackJobPSet::Source, and AlCaHLTBitMon_QueryRunRegistry::string.

                                                                                                    {
  const std::string category ="EcalRawToRecHit|Cand";
  
  edm::Handle<CollectionType> candColl;
  e.getByLabel(cjpset.Source, candColl);
  if (candColl.failedToGet()) {
    edm::LogError("IncorrectConfiguration")<<"could not get: "<<cjpset.Source<<" of type: "<<cjpset.cType;
    return;
  }

  typename CollectionType::const_iterator it = candColl->begin();
  typename CollectionType::const_iterator end= candColl->end();

  StateOnTrackerBound * onBounds=0;
  edm::ESHandle<Propagator> propH;
  if (cjpset.bePrecise){
    //      grab a propagator from ES
    es.get<TrackingComponentsRecord>().get(cjpset.propagatorNameToBePrecise, propH);
    //      make the extrapolator object
    onBounds = new StateOnTrackerBound(propH.product());
  }
  
  for (; it!=end;++it){
    double pt    =  it->pt();
    double eta   =  it->eta();
    double phi   =  it->phi();
    if (cjpset.bePrecise){
      //      starting FTS
      GlobalPoint point(it->vx(),it->vy(),it->vz());
      GlobalVector vector(it->px(),it->py(),it->pz());

      if (point.mag()==0 && vector.mag()==0){
        edm::LogWarning("IncorrectRecHit")<<" state of candidate is not valid. skipping.";
        continue;
      }

      FreeTrajectoryState fts(point, vector, it->charge(), propH->magneticField());
      //      final TSOS
      TrajectoryStateOnSurface out = (*onBounds)(fts);
      if (out.isValid()){
        vector=out.globalMomentum();
        point=out.globalPosition();
        //      be more precise
        pt= vector.perp();
        eta= point.eta();
        phi= point.phi();
      }
      else{edm::LogWarning("IncorrectRecHit")<<"I tried to be precise, but propagation failed. from:\n"<<fts;
        continue;}
    }
    
    LogDebug(category)<<" here is a candidate Seed  with (eta,phi) = " 
                      <<eta << " " << phi << " and pt " << pt;
    if (pt < cjpset.Ptmin) continue;
    
    ListOfFEDS(eta, eta, phi-cjpset.epsilon, phi+cjpset.epsilon, cjpset.regionEtaMargin, cjpset.regionPhiMargin,feds);
  }
  if(cjpset.bePrecise){delete onBounds;}
}
void EcalRawToRecHitRoI::produce ( edm::Event e,
const edm::EventSetup c 
) [virtual]

Implements edm::EDProducer.

Definition at line 155 of file EcalRawToRecHitRoI.cc.

References All_, Cand(), Candidate_, python::rootplot::argparse::category, do_es_, dumpFEDs(), Egamma(), EGamma_, esinstance_, edm::HandleBase::failedToGet(), edm::EventSetup::get(), edm::Event::getByLabel(), ESElectronicsMapper::GetListofFEDs(), i, Jet(), Jet_, LogDebug, FEDNumbering::MINECALFEDID, Muon(), Muon_, edm::Event::put(), sourceTag_, sourceTag_es_, AlCaHLTBitMon_QueryRunRegistry::string, TheESMapping, and TheMapping.

                                                                         {
  const std::string category = "EcalRawToRecHit|RoI";
//  MyWatcher watcher("RoI");
//  LogDebug(category)<<watcher.lap();
//std::cout<<watcher.lap() << std::endl;
  // retreive cabling
  edm::ESHandle<EcalRegionCabling> cabling;
  iSetup.get<EcalRegionCablingRecord>().get(cabling);
  LogDebug(category)<<"cabling retrieved.";
//                  <<watcher.lap();
  TheMapping =cabling->mapping();
  TheESMapping =cabling->es_mapping();

  std::auto_ptr<EcalListOfFEDS> productAddress(new EcalListOfFEDS);
  std::vector<int> feds;                // the list of FEDS produced by this module

 if (EGamma_) {   Egamma(e, iSetup, feds); }

 if (Muon_) {   Muon(e, iSetup, feds); }

 if (Jet_) {   Jet(e, iSetup, feds); }

 if (Candidate_) { Cand(e, iSetup, feds); }

 if (All_)  {   for (int i=1; i <= 54; feds.push_back(i++)){} }
 
 unsigned int nf = feds.size();
 for (unsigned int i=0; i <nf; feds[i++]+=FEDNumbering::MINECALFEDID) {}
 
 LogDebug(category)<< "Will unpack Ecal FED\n" <<dumpFEDs(feds) ;
//                 <<watcher.lap();
 
 // if (nf<1){edm::LogWarning(category)<<"no ECAL FED to unpack for Run " << e.id().run() << "  Event " << e.id().event() ;}
 
 productAddress->SetList(feds);
 e.put(productAddress);
 LogDebug(category)<< "list of ECAL fed put in the event." ;
//                 <<watcher.lap();


 //now defined the Region of interest to be unpacked. from the feds list

 
 //get the lazy gettters
 edm::Handle<EcalRecHitLazyGetter> lgetter;
 e.getByLabel(sourceTag_, lgetter);
 if (lgetter.failedToGet())
   {
     edm::LogError("IncorrectConfiguration")<<" could not retrieve the lazy getter from: "<<sourceTag_;
     return;
   }

 LogDebug(category)<<"Ecal lazy getter retrieved from: "<<sourceTag_ ;
//                 <<watcher.lap();
 

 //prepare a refgetter
 std::auto_ptr<EcalRecHitRefGetter> rgetter(new EcalRecHitRefGetter);
 LogDebug(category)<<"ECal ref getter ready to be updated." ;
//                 <<watcher.lap();

 for (unsigned int i=0;i!=nf;i++){
   cabling->updateEcalRefGetterWithFedIndex(*rgetter, lgetter, feds[i]);
   //cabling->updateEcalRefGetterWithElementIndex(*rgetter, lgetter, cabling->elementIndex(feds[i]));
 }

 //put the refgetters in the event  
 LogDebug(category)<<"Ecal refGetter to be put in the event." ;
//                 << watcher.lap();
 e.put(rgetter);
 LogDebug(category)<<"Ecal refGetter loaded." ;
//                 << watcher.lap();

 //further process the ES if required
 if (do_es_){
   LogDebug(category)<< "Will make the ES list of FEDs at the same time." ;
//                   <<watcher.lap();
   std::auto_ptr<ESListOfFEDS> productAddressES(new ESListOfFEDS);
   std::vector<int> es_feds = TheESMapping->GetListofFEDs(feds);

   LogDebug(category)<< "Will unpack ES FED\n" <<dumpFEDs(es_feds) ;
//                   <<watcher.lap();
 

   productAddressES->SetList(es_feds);
   e.put(productAddressES,esinstance_);


   LogDebug(category)<< "list of ES fed put in the event." ;
//                   <<watcher.lap();
   
   edm::Handle<EcalRecHitLazyGetter> lgetter_es;
   e.getByLabel(sourceTag_es_, lgetter_es);
   if (lgetter_es.failedToGet())
     {
       edm::LogError("IncorrectConfiguration")<<" could not retrieve the lazy getter from: "<<sourceTag_es_;
       return;
     }

   LogDebug(category)<<"ES lazy getter retrieved from: "<<sourceTag_es_ ;
//                   <<watcher.lap();

   std::auto_ptr<EcalRecHitRefGetter> rgetter_es(new EcalRecHitRefGetter);
   LogDebug(category)<<"ES ref getter ready to be updated." ;
//                   <<watcher.lap();
   
   unsigned int nf_es=es_feds.size();
   for (unsigned int i=0;i!=nf_es;i++){
     cabling->updateEcalRefGetterWithElementIndex(*rgetter_es, lgetter_es, cabling->esElementIndex(es_feds[i]));
   }
   
   LogDebug(category)<<"ES refGetter to be put in the event." ;
//                   << watcher.lap();
   e.put(rgetter_es,esinstance_);
   LogDebug(category)<<"ES refGetter loaded." ;
//                   << watcher.lap();
 }

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

remove duplicates

Definition at line 160 of file EcalRawToRecHitRoI.h.

References python::multivaluedict::sort().

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

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

Member Data Documentation

bool EcalRawToRecHitRoI::All_ [private]

if all need to be done

Definition at line 152 of file EcalRawToRecHitRoI.h.

Referenced by EcalRawToRecHitRoI(), and produce().

Candidate-versatile objects part flag.

Definition at line 130 of file EcalRawToRecHitRoI.h.

Referenced by EcalRawToRecHitRoI(), and produce().

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

what drives the job from candidate

Definition at line 149 of file EcalRawToRecHitRoI.h.

Referenced by Cand(), and EcalRawToRecHitRoI().

Definition at line 60 of file EcalRawToRecHitRoI.h.

Referenced by EcalRawToRecHitRoI(), and produce().

Egamma part flag.

Definition at line 85 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 98 of file EcalRawToRecHitRoI.h.

Referenced by EcalRawToRecHitRoI(), and Egamma().

std::string EcalRawToRecHitRoI::esinstance_ [private]

Definition at line 62 of file EcalRawToRecHitRoI.h.

Referenced by EcalRawToRecHitRoI(), and produce().

bool EcalRawToRecHitRoI::Jet_ [private]

jet part flag

Definition at line 114 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 127 of file EcalRawToRecHitRoI.h.

Referenced by EcalRawToRecHitRoI(), and Jet().

bool EcalRawToRecHitRoI::Muon_ [private]

Muon part flag.

Definition at line 101 of file EcalRawToRecHitRoI.h.

Referenced by EcalRawToRecHitRoI(), and produce().

what drives the job from ONE L1Muon collection

Definition at line 111 of file EcalRawToRecHitRoI.h.

Referenced by EcalRawToRecHitRoI(), and Muon().

input tag for the lazy getter

Definition at line 59 of file EcalRawToRecHitRoI.h.

Referenced by EcalRawToRecHitRoI(), and produce().

Definition at line 61 of file EcalRawToRecHitRoI.h.

Referenced by EcalRawToRecHitRoI(), and produce().

Definition at line 66 of file EcalRawToRecHitRoI.h.

Referenced by produce().

tools

Definition at line 65 of file EcalRawToRecHitRoI.h.

Referenced by ListOfFEDS(), and produce().