CMS 3D CMS Logo

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

RPCSeedLayerFinder Class Reference

#include <RPCSeedLayerFinder.h>

List of all members.

Public Member Functions

void configure (const edm::ParameterSet &iConfig)
void fill ()
 RPCSeedLayerFinder ()
void setInput (MuonRecHitContainer(&recHitsRPC)[RPCLayerNumber])
void setOutput (RPCSeedrecHitFinder *Ref, RPCCosmicSeedrecHitFinder *CosmicRef)
void unsetInput ()
 ~RPCSeedLayerFinder ()

Private Types

typedef
MuonTransientTrackingRecHit::ConstMuonRecHitContainer 
ConstMuonRecHitContainer
typedef
MuonTransientTrackingRecHit::ConstMuonRecHitPointer 
ConstMuonRecHitPointer
typedef
MuonTransientTrackingRecHit::MuonRecHitContainer 
MuonRecHitContainer
typedef
MuonTransientTrackingRecHit::MuonRecHitPointer 
MuonRecHitPointer

Private Member Functions

bool checkConstrain ()
void fillCosmicLayers ()
void fillLayers ()
void SpecialLayers (int last, unsigned int NumberofLayers, int type)

Private Attributes

std::vector< unsigned int > constrainedLayersinBarrel
bool isConfigured
bool isCosmic
bool isInputset
bool isMixBarrelwithEndcap
bool isOutputset
bool isSpecialLayers
std::vector< unsigned int > LayersinBarrel
std::vector< unsigned int > LayersinEndcap
std::vector< unsigned int > LayersinRPC
std::vector< unsigned int > RangeofLayersinBarrel
std::vector< unsigned int > RangeofLayersinEndcap
unsigned int recHitsinLayers [RPCLayerNumber]
RPCCosmicSeedrecHitFinderRPCCosmicrecHitFinderRef
RPCSeedrecHitFinderRPCrecHitFinderRef

Detailed Description

Author:
Haiyun.Teng - Peking University

Definition at line 31 of file RPCSeedLayerFinder.h.


Member Typedef Documentation

Definition at line 36 of file RPCSeedLayerFinder.h.

Definition at line 34 of file RPCSeedLayerFinder.h.

Definition at line 35 of file RPCSeedLayerFinder.h.

Definition at line 33 of file RPCSeedLayerFinder.h.


Constructor & Destructor Documentation

RPCSeedLayerFinder::RPCSeedLayerFinder ( )

Definition at line 13 of file RPCSeedLayerFinder.cc.

                                       {

    // Initiate the member
    LayersinRPC.clear();  
    isConfigured = false;
    isInputset = false;
    isOutputset = false;
}
RPCSeedLayerFinder::~RPCSeedLayerFinder ( )

Definition at line 22 of file RPCSeedLayerFinder.cc.

                                        {

}

Member Function Documentation

bool RPCSeedLayerFinder::checkConstrain ( ) [private]

Definition at line 363 of file RPCSeedLayerFinder.cc.

References BarrelLayerNumber, and i.

                                        {

    bool pass = true;
    std::vector<unsigned int> fitConstrain = constrainedLayersinBarrel;
    for(unsigned int i = 0; i < LayersinRPC.size(); i++)
        fitConstrain[LayersinRPC[i]] = 0;
    for(unsigned int i = 0; i < BarrelLayerNumber; i++)
        if(fitConstrain[i] != 0)
            pass = false;
    return pass;
}
void RPCSeedLayerFinder::configure ( const edm::ParameterSet iConfig)

Definition at line 26 of file RPCSeedLayerFinder.cc.

References edm::ParameterSet::getParameter().

                                                                 {

    // Set the configuration
    isCosmic = iConfig.getParameter<bool>("isCosmic");
    isMixBarrelwithEndcap = iConfig.getParameter<bool>("isMixBarrelwithEndcap");
    RangeofLayersinBarrel = iConfig.getParameter< std::vector<unsigned int> >("RangeofLayersinBarrel");
    RangeofLayersinEndcap = iConfig.getParameter< std::vector<unsigned int> >("RangeofLayersinEndcap");
    isSpecialLayers = iConfig.getParameter<bool>("isSpecialLayers");
    LayersinBarrel = iConfig.getParameter< std::vector<unsigned int> >("LayersinBarrel");
    LayersinEndcap = iConfig.getParameter< std::vector<unsigned int> >("LayersinEndcap");
    constrainedLayersinBarrel = iConfig.getParameter< std::vector<unsigned int> >("constrainedLayersinBarrel");

    // Set the signal open
    isConfigured = true;
}
void RPCSeedLayerFinder::fill ( void  )

Definition at line 63 of file RPCSeedLayerFinder.cc.

References gather_cfg::cout, and NULL.

                              {

    // Check if already configured
    if(isConfigured == false || isInputset == false || isOutputset == false) {
        cout << "RPCSeedLayerFinder needs to be configured and set IO before running RPCSeedLayerFinder::fillLayers()" << endl;
        return;
    }

    // Clear the vector LayersinRPC
    LayersinRPC.clear();

    // Now fill the Layers
    if(isCosmic == true) {
        if(RPCCosmicrecHitFinderRef != NULL)
            fillCosmicLayers();
        else
            cout << "RPCCosmicrecHitFinderRef not set" << endl;
    }
    else {
        if(RPCrecHitFinderRef != NULL)
            fillLayers();
        else
            cout << "RPCrecHitFinderRef not set" << endl;
    }
}
void RPCSeedLayerFinder::fillCosmicLayers ( ) [private]

Definition at line 193 of file RPCSeedLayerFinder.cc.

References BarrelLayerNumber, gather_cfg::cout, EachEndcapLayerNumber, and i.

                                          {
    
    // For cosmic only handle the SpecialLayers case
    if(isSpecialLayers == true && isMixBarrelwithEndcap == false) {

        // Fill barrel layer for seed
        unsigned int i = 0;
        LayersinRPC.clear();
        for(std::vector<unsigned int>::iterator it = LayersinBarrel.begin(); it != LayersinBarrel.end(); it++, i++) {   
            if((*it) != 0 && i < BarrelLayerNumber)
                if(recHitsinLayers[i] != 0)
                    LayersinRPC.push_back(i);
        }
        if(LayersinRPC.size() != 0) {
            // Initiate and call recHit Finder
            RPCCosmicrecHitFinderRef->setLayers(LayersinRPC);
            RPCCosmicrecHitFinderRef->fillrecHits();
        }
        LayersinRPC.clear();

        // Fill -Z and +Z endcap layer

        // Fill endcap- layer for seed
        i = BarrelLayerNumber;
        LayersinRPC.clear();
        for(std::vector<unsigned int>::iterator it = LayersinEndcap.begin(); it != LayersinEndcap.end(); it++, i++) {
            if((*it) != 0 && i < (BarrelLayerNumber+EachEndcapLayerNumber))
                if(recHitsinLayers[i] != 0)
                    LayersinRPC.push_back(i);
        }
        if(LayersinRPC.size() != 0) {
            // Initiate and call recHit Finder
            RPCCosmicrecHitFinderRef->setLayers(LayersinRPC);
            RPCCosmicrecHitFinderRef->fillrecHits();
        }
        LayersinRPC.clear();

        //Fill endcap+ layer for seed
        i = BarrelLayerNumber;
        LayersinRPC.clear();
        for(std::vector<unsigned int>::iterator it = LayersinEndcap.begin(); it != LayersinEndcap.end(); it++, i++) {
            if((*it) != 0 && i >= (BarrelLayerNumber+EachEndcapLayerNumber) && i < (BarrelLayerNumber+EachEndcapLayerNumber*2))
                if(recHitsinLayers[i] != 0)
                    LayersinRPC.push_back(i);
        }
        if(LayersinRPC.size() != 0) {
            // Initiate and call recHit Finder
            RPCCosmicrecHitFinderRef->setLayers(LayersinRPC);
            RPCCosmicrecHitFinderRef->fillrecHits();
        }
        LayersinRPC.clear();
    }

    if(isSpecialLayers == true && isMixBarrelwithEndcap == true) {

        // Fill all
        unsigned int i = 0;
        LayersinRPC.clear();
        for(std::vector<unsigned int>::iterator it = LayersinBarrel.begin(); it != LayersinBarrel.end(); it++, i++) {   
            if((*it) != 0 && i < BarrelLayerNumber)
                if(recHitsinLayers[i] != 0)
                    LayersinRPC.push_back(i);
        }
        i = BarrelLayerNumber;
        for(std::vector<unsigned int>::iterator it = LayersinEndcap.begin(); it != LayersinEndcap.end(); it++, i++) {
            if((*it) != 0 && i < (BarrelLayerNumber+EachEndcapLayerNumber*2))
                if(recHitsinLayers[i] != 0)
                    LayersinRPC.push_back(i);
        }

        if(LayersinRPC.size() != 0) {
            // Initiate and call recHit Finder
            RPCCosmicrecHitFinderRef->setLayers(LayersinRPC);
            RPCCosmicrecHitFinderRef->fillrecHits();
        }
        LayersinRPC.clear();
    }

    if(isSpecialLayers == false) {
        cout << "Not ready for not SpecialLayers for Cosmic case" << endl;
        LayersinRPC.clear();
    }
}
void RPCSeedLayerFinder::fillLayers ( ) [private]

Definition at line 89 of file RPCSeedLayerFinder.cc.

References BarrelLayerNumber, gather_cfg::cout, EachEndcapLayerNumber, and i.

                                    {

    if(isSpecialLayers == false && isMixBarrelwithEndcap == false) {
        for(std::vector<unsigned int>::iterator NumberofLayersinBarrel = RangeofLayersinBarrel.begin(); NumberofLayersinBarrel != RangeofLayersinBarrel.end(); NumberofLayersinBarrel++) {
            // find N layers out of 6 Barrel Layers to fill to SeedinRPC
            unsigned int NumberofLayers = *NumberofLayersinBarrel;
            if(NumberofLayers < 1 || NumberofLayers > BarrelLayerNumber)
                continue;
            int type = 0;  // type=0 for barrel
            LayersinRPC.clear();
            SpecialLayers(-1, NumberofLayers, type);
            LayersinRPC.clear();
        }

        for(std::vector<unsigned int>::iterator NumberofLayersinEndcap = RangeofLayersinEndcap.begin(); NumberofLayersinEndcap != RangeofLayersinEndcap.end(); NumberofLayersinEndcap++) {
            unsigned int NumberofLayers = *NumberofLayersinEndcap;
            if(NumberofLayers < 1 || NumberofLayers > EachEndcapLayerNumber)
                continue;
            int type = 1; // type=1 for endcap
            // for -Z layers
            LayersinRPC.clear();
            SpecialLayers(BarrelLayerNumber-1, NumberofLayers, type);
            LayersinRPC.clear();
            //for +Z layers
            LayersinRPC.clear();
            SpecialLayers(BarrelLayerNumber+EachEndcapLayerNumber-1, NumberofLayers, type);
            LayersinRPC.clear();
        }
    }

    if(isSpecialLayers == true && isMixBarrelwithEndcap == false) {
        // Fill barrel layer for seed
        bool EnoughforBarrel = true;
        unsigned int i = 0;
        LayersinRPC.clear();
        for(std::vector<unsigned int>::iterator it = LayersinBarrel.begin(); it != LayersinBarrel.end(); it++, i++) {   
            if((*it) != 0 && i < BarrelLayerNumber) {
                if(recHitsinLayers[i] != 0)
                    LayersinRPC.push_back(i);
                else {
                    cout << "Not recHits in special Barrel layer " << i << endl;
                    EnoughforBarrel = false;
                }
            }
        }
        if(EnoughforBarrel && (LayersinRPC.size() != 0)) {
            // Initiate and call recHit Finder
            RPCrecHitFinderRef->setLayers(LayersinRPC);
            RPCrecHitFinderRef->fillrecHits();
        }
        LayersinRPC.clear();

        // Fill -Z and +Z endcap layer
        bool EnoughforEndcap = true;

        // Fill endcap- layer for seed
        i = BarrelLayerNumber;
        EnoughforEndcap = true;
        LayersinRPC.clear();
        for(std::vector<unsigned int>::iterator it = LayersinEndcap.begin(); it != LayersinEndcap.end(); it++, i++) {
            if((*it) != 0 && i < (BarrelLayerNumber+EachEndcapLayerNumber)) {
                if(recHitsinLayers[i] != 0)
                    LayersinRPC.push_back(i);
                else {
                    cout << "Not recHits in special Endcap " << (i - BarrelLayerNumber) << endl;
                    EnoughforEndcap = false;
                }
            }
        }
        if(EnoughforEndcap && (LayersinRPC.size() != 0)) {
            // Initiate and call recHit Finder
            RPCrecHitFinderRef->setLayers(LayersinRPC);
            RPCrecHitFinderRef->fillrecHits();
        }
        LayersinRPC.clear();

        //Fill endcap+ layer for seed
        i = BarrelLayerNumber;
        EnoughforEndcap = true;
        LayersinRPC.clear();
        for(std::vector<unsigned int>::iterator it = LayersinEndcap.begin(); it != LayersinEndcap.end(); it++, i++) {
            if((*it) != 0 && i >= (BarrelLayerNumber+EachEndcapLayerNumber) && i < (BarrelLayerNumber+EachEndcapLayerNumber*2)) {
                if(recHitsinLayers[i] != 0)
                    LayersinRPC.push_back(i);
                else {
                    cout << "Not recHits in special Endcap " << i << endl;
                    EnoughforEndcap = false;
                }
            }
        }
        if(EnoughforEndcap && (LayersinRPC.size() != 0)) {
            // Initiate and call recHit Finder
            RPCrecHitFinderRef->setLayers(LayersinRPC);
            RPCrecHitFinderRef->fillrecHits();
        }
        LayersinRPC.clear();
    }

    if(isMixBarrelwithEndcap == true) {
        cout <<" Mix is not ready for non-cosmic case" << endl;
        LayersinRPC.clear();
    }
}
void RPCSeedLayerFinder::setInput ( MuonRecHitContainer(&)  recHitsRPC[RPCLayerNumber])

Definition at line 42 of file RPCSeedLayerFinder.cc.

References i, RPCLayerNumber, and findQualityFiles::size.

                                                                                   {

    for(unsigned int i = 0; i < RPCLayerNumber; i++)
        recHitsinLayers[i] = recHitsRPC[i].size();

    // Set the signal open
    isInputset = true;
}
void RPCSeedLayerFinder::setOutput ( RPCSeedrecHitFinder Ref = NULL,
RPCCosmicSeedrecHitFinder CosmicRef = NULL 
)

Definition at line 56 of file RPCSeedLayerFinder.cc.

void RPCSeedLayerFinder::SpecialLayers ( int  last,
unsigned int  NumberofLayers,
int  type 
) [private]

Definition at line 277 of file RPCSeedLayerFinder.cc.

References BarrelLayerNumber, gather_cfg::cout, EachEndcapLayerNumber, i, and gen::k.

                                                                                      {

    // check type, 0=barrel, 1=endcap, 2=mix

    // barrel has 6 layers
    if(type == 0) {
        if(NumberofLayers > BarrelLayerNumber) {
            cout << "NumberofLayers larger than max layers in barrel" << endl;
            return;
        }
        for(unsigned int i = (last+1); i <= (BarrelLayerNumber-NumberofLayers+LayersinRPC.size()); i++) {
            if(recHitsinLayers[i] != 0) {
                LayersinRPC.push_back(i);
                last = i;
                if(LayersinRPC.size() < NumberofLayers)
                    SpecialLayers(last, NumberofLayers, type);
                else {
                    if(checkConstrain()) {
                        cout << "Find special barrel layers: ";
                        for(unsigned int k = 0; k < NumberofLayers; k++)
                            cout << LayersinRPC[k] <<" ";
                        cout << endl;
                        // Initiate and call recHit Finder
                        RPCrecHitFinderRef->setLayers(LayersinRPC);
                        RPCrecHitFinderRef->fillrecHits();
                    }
                    else
                        cout << "The layers don't contain all layers in constrain" << endl;
                }
                LayersinRPC.pop_back();
            }
        }
    }

    // endcap has 3 layers for each -Z and +Z
    if(type == 1) {
        if(NumberofLayers > EachEndcapLayerNumber) {
            cout << "NumberofLayers larger than max layers in endcap" << endl;
            return;
        }
        if(last < (BarrelLayerNumber+EachEndcapLayerNumber-1) || (last == (BarrelLayerNumber+EachEndcapLayerNumber-1) && LayersinRPC.size() != 0)) {
            // For -Z case
            for(unsigned int i =  (last+1); i <= (BarrelLayerNumber+EachEndcapLayerNumber-NumberofLayers+LayersinRPC.size()); i++) {
                if(recHitsinLayers[i] != 0) {
                    LayersinRPC.push_back(i);
                    last = i;
                    if(LayersinRPC.size() < NumberofLayers)
                        SpecialLayers(last, NumberofLayers, type);
                    else {
                        cout << "Find special -Z endcap layers: ";
                        for(unsigned int k = 0; k < NumberofLayers; k++)
                            cout << LayersinRPC[k] <<" ";
                        cout << endl;
                        // Initiate and call recHit Finder
                        RPCrecHitFinderRef->setLayers(LayersinRPC);
                        RPCrecHitFinderRef->fillrecHits();
                    }
                    LayersinRPC.pop_back();
                }
            }
        }
        else
        {
            // For +Z case
            for(unsigned int i = (last+1); i <= (BarrelLayerNumber+EachEndcapLayerNumber*2-NumberofLayers+LayersinRPC.size()); i++) {
                if(recHitsinLayers[i] != 0) {
                    LayersinRPC.push_back(i);
                    last = i;
                    if(LayersinRPC.size() < NumberofLayers)
                        SpecialLayers(last, NumberofLayers, type);
                    else {
                        cout << "Find special +Z endcap layers: ";
                        for(unsigned int k = 0; k < NumberofLayers; k++)
                            cout << LayersinRPC[k] <<" ";
                        cout << endl;
                        // Initiate and call recHit Finder
                        RPCrecHitFinderRef->setLayers(LayersinRPC);
                        RPCrecHitFinderRef->fillrecHits();
                    }
                    LayersinRPC.pop_back();
                }
            }
        }
    }
}
void RPCSeedLayerFinder::unsetInput ( )

Definition at line 51 of file RPCSeedLayerFinder.cc.

                                    {

    isInputset = false;
}

Member Data Documentation

std::vector<unsigned int> RPCSeedLayerFinder::constrainedLayersinBarrel [private]

Definition at line 67 of file RPCSeedLayerFinder.h.

Definition at line 69 of file RPCSeedLayerFinder.h.

Definition at line 60 of file RPCSeedLayerFinder.h.

Definition at line 70 of file RPCSeedLayerFinder.h.

Definition at line 61 of file RPCSeedLayerFinder.h.

Definition at line 71 of file RPCSeedLayerFinder.h.

Definition at line 64 of file RPCSeedLayerFinder.h.

std::vector<unsigned int> RPCSeedLayerFinder::LayersinBarrel [private]

Definition at line 66 of file RPCSeedLayerFinder.h.

std::vector<unsigned int> RPCSeedLayerFinder::LayersinEndcap [private]

Definition at line 65 of file RPCSeedLayerFinder.h.

std::vector<unsigned int> RPCSeedLayerFinder::LayersinRPC [private]

Definition at line 73 of file RPCSeedLayerFinder.h.

std::vector<unsigned int> RPCSeedLayerFinder::RangeofLayersinBarrel [private]

Definition at line 62 of file RPCSeedLayerFinder.h.

std::vector<unsigned int> RPCSeedLayerFinder::RangeofLayersinEndcap [private]

Definition at line 63 of file RPCSeedLayerFinder.h.

unsigned int RPCSeedLayerFinder::recHitsinLayers[RPCLayerNumber] [private]

Definition at line 75 of file RPCSeedLayerFinder.h.

Definition at line 58 of file RPCSeedLayerFinder.h.

Definition at line 57 of file RPCSeedLayerFinder.h.