CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

RPCSeedGenerator Class Reference

#include <RecoMuon/MuonSeedGenerator/src/RPCSeedGenerator.cc>

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

List of all members.

Public Member Functions

 RPCSeedGenerator (const edm::ParameterSet &iConfig)
 ~RPCSeedGenerator ()

Private Member Functions

virtual void beginJob ()
virtual void beginRun (const edm::Run &, const edm::EventSetup &iSetup)
virtual void endJob ()
virtual void produce (edm::Event &iEvent, const edm::EventSetup &iSetup)

Private Attributes

std::vector
< weightedTrajectorySeed
candidateweightedSeeds
RPCCosmicSeedrecHitFinder CosmicrecHitFinder
RPCSeedFinder Finder
std::vector
< weightedTrajectorySeed
goodweightedSeeds
RPCSeedLayerFinder LayerFinder
RPCSeedOverlapper Overlapper
RPCSeedrecHitFinder recHitFinder
edm::InputTag theRPCRecHits

Detailed Description

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 86 of file RPCSeedGenerator.cc.


Constructor & Destructor Documentation

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

Definition at line 121 of file RPCSeedGenerator.cc.

References gather_cfg::cout, and edm::ParameterSet::getParameter().

{
    //register your products
    /* Examples
       produces<ExampleData2>();

    //if do put with a label
    produces<ExampleData2>("label");
    */

    // Now do what ever other initialization is needed
    // Configure other modules
    Finder.configure(iConfig);
    recHitFinder.configure(iConfig);
    CosmicrecHitFinder.configure(iConfig);
    LayerFinder.configure(iConfig);
    Overlapper.configure(iConfig);
    // Register the production
    produces<TrajectorySeedCollection>("goodSeeds");
    produces<TrajectorySeedCollection>("candidateSeeds");
    // Get event data Tag
    theRPCRecHits = iConfig.getParameter<edm::InputTag>("RPCRecHitsLabel");
    
    cout << endl << "[RPCSeedGenerator] --> Constructor called" << endl;
}
RPCSeedGenerator::~RPCSeedGenerator ( )

Definition at line 148 of file RPCSeedGenerator.cc.

References gather_cfg::cout.

{
    // do anything here that needs to be done at desctruction time
    // (e.g. close files, deallocate resources etc.)
    cout << "[RPCSeedGenerator] --> Destructor called" << endl;
}

Member Function Documentation

void RPCSeedGenerator::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDProducer.

Definition at line 271 of file RPCSeedGenerator.cc.

References gather_cfg::cout.

                                {

    // Set link and EventSetup of RPCSeedFinder, PCSeedrecHitFinder, CosmicrecHitFinder, RPCSeedLayerFinder
    cout << "set link and Geometry EventSetup of RPCSeedFinder, RPCSeedrecHitFinder, RPCCosmicSeedrecHitFinder, RPCSeedLayerFinder and RPCSeedOverlapper" << endl;
    
    Finder.setOutput(&goodweightedSeeds, &candidateweightedSeeds);
    recHitFinder.setOutput(&Finder);
    CosmicrecHitFinder.setOutput(&Finder);
    LayerFinder.setOutput(&recHitFinder, &CosmicrecHitFinder);
}
void RPCSeedGenerator::beginRun ( const edm::Run ,
const edm::EventSetup iSetup 
) [private, virtual]
void RPCSeedGenerator::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDProducer.

Definition at line 287 of file RPCSeedGenerator.cc.

References gather_cfg::cout.

                              {

    cout << "All jobs completed" << endl;
}
void RPCSeedGenerator::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDProducer.

Definition at line 162 of file RPCSeedGenerator.cc.

References gather_cfg::cout, edm::EventSetup::get(), edm::Event::put(), MuonDetLayerMeasurements::recHits(), and RPCLayerNumber.

{
    using namespace edm;
    /* This is an event example
    //Read 'ExampleData' from the Event
    Handle<ExampleData> pIn;
    iEvent.getByLabel("example",pIn);

    //Use the ExampleData to create an ExampleData2 which 
    // is put into the Event
    std::auto_ptr<ExampleData2> pOut(new ExampleData2(*pIn));
    iEvent.put(pOut);
    */

    /* this is an EventSetup example
    //Read SetupData from the SetupRecord in the EventSetup
    ESHandle<SetupData> pSetup;
    iSetup.get<SetupRecord>().get(pSetup);
    */

    // clear weighted Seeds from last reconstruction  
    goodweightedSeeds.clear();
    candidateweightedSeeds.clear();

    // Create the pointer to the Seed container
    auto_ptr<TrajectorySeedCollection> goodCollection(new TrajectorySeedCollection());
    auto_ptr<TrajectorySeedCollection> candidateCollection(new TrajectorySeedCollection());

    // Muon Geometry - DT, CSC and RPC 
    edm::ESHandle<MuonDetLayerGeometry> muonLayers;
    iSetup.get<MuonRecoGeometryRecord>().get(muonLayers);

    // Get the RPC layers
    vector<DetLayer*> RPCBarrelLayers = muonLayers->barrelRPCLayers();
    const DetLayer* RB4L  = RPCBarrelLayers[5];
    const DetLayer* RB3L  = RPCBarrelLayers[4];
    const DetLayer* RB22L = RPCBarrelLayers[3];
    const DetLayer* RB21L = RPCBarrelLayers[2];
    const DetLayer* RB12L = RPCBarrelLayers[1];
    const DetLayer* RB11L = RPCBarrelLayers[0];
    vector<DetLayer*> RPCEndcapLayers = muonLayers->endcapRPCLayers();
    const DetLayer* REM3L = RPCEndcapLayers[0];
    const DetLayer* REM2L = RPCEndcapLayers[1];
    const DetLayer* REM1L = RPCEndcapLayers[2];
    const DetLayer* REP1L = RPCEndcapLayers[3];
    const DetLayer* REP2L = RPCEndcapLayers[4];
    const DetLayer* REP3L = RPCEndcapLayers[5];

    // Get RPC recHits by MuonDetLayerMeasurements, while CSC and DT is set to false and with empty InputTag
    MuonDetLayerMeasurements muonMeasurements(edm::InputTag(), edm::InputTag(), theRPCRecHits, false, false, true);

    // Dispatch RPC recHits to the corresponding DetLayer, 6 layers for barrel and 3 layers for each endcap
    MuonRecHitContainer recHitsRPC[RPCLayerNumber];
    recHitsRPC[0] = muonMeasurements.recHits(RB11L, iEvent);
    recHitsRPC[1] = muonMeasurements.recHits(RB12L, iEvent);
    recHitsRPC[2] = muonMeasurements.recHits(RB21L, iEvent);
    recHitsRPC[3] = muonMeasurements.recHits(RB22L, iEvent);
    recHitsRPC[4] = muonMeasurements.recHits(RB3L, iEvent);
    recHitsRPC[5] = muonMeasurements.recHits(RB4L, iEvent); 
    recHitsRPC[6] = muonMeasurements.recHits(REM1L, iEvent);
    recHitsRPC[7] = muonMeasurements.recHits(REM2L, iEvent);
    recHitsRPC[8] = muonMeasurements.recHits(REM3L, iEvent);
    recHitsRPC[9] = muonMeasurements.recHits(REP1L, iEvent);
    recHitsRPC[10] = muonMeasurements.recHits(REP2L, iEvent);
    recHitsRPC[11] = muonMeasurements.recHits(REP3L, iEvent);

    // Print the size of recHits in each DetLayer
    cout << "RB1in "  << recHitsRPC[0].size()  << " recHits" << endl;
    cout << "RB1out " << recHitsRPC[1].size()  << " recHits" << endl;
    cout << "RB2in "  << recHitsRPC[2].size()  << " recHits" << endl;
    cout << "RB2out " << recHitsRPC[3].size()  << " recHits" << endl;
    cout << "RB3 "    << recHitsRPC[4].size()  << " recHits" << endl;
    cout << "RB4 "    << recHitsRPC[5].size()  << " recHits" << endl;
    cout << "REM1 "   << recHitsRPC[6].size()  << " recHits" << endl;
    cout << "REM2 "   << recHitsRPC[7].size()  << " recHits" << endl;
    cout << "REM3 "   << recHitsRPC[8].size()  << " recHits" << endl;
    cout << "REP1 "   << recHitsRPC[9].size()  << " recHits" << endl;
    cout << "REP2 "   << recHitsRPC[10].size() << " recHits" << endl;
    cout << "REP3 "   << recHitsRPC[11].size() << " recHits" << endl;

    // Set Input of RPCSeedFinder, PCSeedrecHitFinder, CosmicrecHitFinder, RPCSeedLayerFinder
    recHitFinder.setInput(recHitsRPC);
    CosmicrecHitFinder.setInput(recHitsRPC);
    LayerFinder.setInput(recHitsRPC);
    
    // Set Magnetic Field EventSetup of RPCSeedFinder
    Finder.setEventSetup(iSetup);

    // Start from filling layers to filling seeds
    LayerFinder.fill();
    Overlapper.run();

    // Save seeds to event
    for(vector<weightedTrajectorySeed>::iterator weightedseed = goodweightedSeeds.begin(); weightedseed != goodweightedSeeds.end(); ++weightedseed)
        goodCollection->push_back((*weightedseed).first);
    for(vector<weightedTrajectorySeed>::iterator weightedseed = candidateweightedSeeds.begin(); weightedseed != candidateweightedSeeds.end(); ++weightedseed)
        candidateCollection->push_back((*weightedseed).first);

    // Put the seed to event
    iEvent.put(goodCollection, "goodSeeds");
    iEvent.put(candidateCollection, "candidateSeeds");

    // Unset the input of RPCSeedFinder, PCSeedrecHitFinder, RPCSeedLayerFinder
    recHitFinder.unsetInput();
    CosmicrecHitFinder.unsetInput();
    LayerFinder.unsetInput();
    
}

Member Data Documentation

Definition at line 103 of file RPCSeedGenerator.cc.

Definition at line 100 of file RPCSeedGenerator.cc.

Definition at line 98 of file RPCSeedGenerator.cc.

Definition at line 104 of file RPCSeedGenerator.cc.

Definition at line 101 of file RPCSeedGenerator.cc.

Definition at line 102 of file RPCSeedGenerator.cc.

Definition at line 99 of file RPCSeedGenerator.cc.

Definition at line 105 of file RPCSeedGenerator.cc.