CMS 3D CMS Logo

Public Member Functions | Private Attributes

ElectronConversionRejectionVars Class Reference

Store electron partner track conversion-rejection quantities ("dist" and "dcot") in the TP tree. More...

Inheritance diagram for ElectronConversionRejectionVars:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 ElectronConversionRejectionVars (const edm::ParameterSet &iConfig)
virtual void produce (edm::Event &iEvent, const edm::EventSetup &iSetup)
virtual ~ElectronConversionRejectionVars ()

Private Attributes

edm::InputTag probes_

Detailed Description

Store electron partner track conversion-rejection quantities ("dist" and "dcot") in the TP tree.

Author:
Kalanand Mishra Fermi National Accelerator Laboratory

Definition at line 33 of file ElectronConversionRejectionVars.cc.


Constructor & Destructor Documentation

ElectronConversionRejectionVars::ElectronConversionRejectionVars ( const edm::ParameterSet iConfig) [explicit]

Definition at line 44 of file ElectronConversionRejectionVars.cc.

                                                                                                :
    probes_(iConfig.getParameter<edm::InputTag>("probes"))
{
    produces<edm::ValueMap<float> >("dist");
    produces<edm::ValueMap<float> >("dcot");
    produces<edm::ValueMap<float> >("convradius");
    produces<edm::ValueMap<float> >("passConvRej");
}
ElectronConversionRejectionVars::~ElectronConversionRejectionVars ( ) [virtual]

Definition at line 54 of file ElectronConversionRejectionVars.cc.

{
}

Member Function Documentation

void ElectronConversionRejectionVars::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [virtual]

Implements edm::EDProducer.

Definition at line 59 of file ElectronConversionRejectionVars.cc.

References ConversionInfo::dcot(), ConversionInfo::dist(), edm::Event::getByLabel(), probes_, edm::Event::put(), ConversionInfo::radiusOfConversion(), and makeHLTPrescaleTable::values.

                                                                                        {
    using namespace edm;

    // read input
    Handle<View<reco::Candidate> > probes;
    edm::Handle<reco::TrackCollection> tracks_h;
    edm::Handle<reco::GsfElectronCollection> elHandle;

    iEvent.getByLabel(probes_,  probes);
    iEvent.getByLabel("generalTracks", tracks_h );
    iEvent.getByLabel("gsfElectrons", elHandle);
    
    float evt_bField = 3.8;


    // prepare vector for output   
    std::vector<float> values;
    std::vector<float> values2;
    std::vector<float> values3;
    std::vector<float> values4;

    // fill: use brute force    
    double dist = 0.0;
    double dcot = 0.0;
    double convradius = 0.0;
    double passConvRej = 0.0;
    ConversionFinder convFinder;

    View<reco::Candidate>::const_iterator probe, endprobes = probes->end(); 
    const reco::GsfElectronCollection* electronCollection = elHandle.product();
    reco::GsfElectronCollection::const_iterator eleIt = electronCollection->begin();

    for (probe = probes->begin(); probe != endprobes; ++probe) {
      for (eleIt=electronCollection->begin(); eleIt!=electronCollection->end(); eleIt++) {
        if( fabs(eleIt->et() - probe->et() ) < 0.05 && fabs(eleIt->eta() - probe->eta() ) < 0.01 
            && fabs(eleIt->phi() - probe->phi() ) < 0.01 ){
          //we have a match    
          ConversionInfo convInfo = convFinder.getConversionInfo(*eleIt, tracks_h, evt_bField);
          dist = convInfo.dist();
          dcot = convInfo.dcot();
          convradius = convInfo.radiusOfConversion();
          if( fabs(dist)>0.02 && fabs(dcot)>0.02)  passConvRej = 1.0;
          break; //got our guy, so break  
        }
      }
      values.push_back(dist);
      values2.push_back(dcot);
      values3.push_back(convradius);
      values4.push_back(passConvRej);
    }


    // convert into ValueMap and store
    std::auto_ptr<ValueMap<float> > valMap(new ValueMap<float>());
    ValueMap<float>::Filler filler(*valMap);
    filler.insert(probes, values.begin(), values.end());
    filler.fill();
    iEvent.put(valMap, "dist");


    // ---> same for dcot   
    std::auto_ptr<ValueMap<float> > valMap2(new ValueMap<float>());
    ValueMap<float>::Filler filler2(*valMap2);
    filler2.insert(probes, values2.begin(), values2.end());
    filler2.fill();
    iEvent.put(valMap2, "dcot");

    // ---> same for convradius   
    std::auto_ptr<ValueMap<float> > valMap3(new ValueMap<float>());
    ValueMap<float>::Filler filler3(*valMap3);
    filler3.insert(probes, values3.begin(), values3.end());
    filler3.fill();
    iEvent.put(valMap3, "convradius");


    // ---> same for passConvRej  
    std::auto_ptr<ValueMap<float> > valMap4(new ValueMap<float>());
    ValueMap<float>::Filler filler4(*valMap4);
    filler4.insert(probes, values4.begin(), values4.end());
    filler4.fill();
    iEvent.put(valMap4, "passConvRej");
}

Member Data Documentation

Definition at line 41 of file ElectronConversionRejectionVars.cc.

Referenced by produce().