CMS 3D CMS Logo

Public Member Functions | Private Types | Private Attributes

cms::ClusterizerFP420 Class Reference

#include <ClusterizerFP420.h>

Inheritance diagram for cms::ClusterizerFP420:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

virtual void beginJob ()
 ClusterizerFP420 (const edm::ParameterSet &conf)
virtual void produce (edm::Event &e, const edm::EventSetup &c)
virtual ~ClusterizerFP420 ()

Private Types

typedef std::vector< std::string > vstring

Private Attributes

edm::ParameterSet conf_
int dn0
std::vector< ClusterNoiseFP420noise
int pn0
int rn0
FP420ClusterMainsClusterizerFP420_
int sn0
ClusterCollectionFP420soutput
FP420NumberingSchemetheFP420NumberingScheme
vstring trackerContainers
bool UseNoiseBadElectrodeFlagFromDB_
int verbosity

Detailed Description

Definition at line 34 of file ClusterizerFP420.h.


Member Typedef Documentation

typedef std::vector<std::string> cms::ClusterizerFP420::vstring [private]

Definition at line 50 of file ClusterizerFP420.h.


Constructor & Destructor Documentation

cms::ClusterizerFP420::ClusterizerFP420 ( const edm::ParameterSet conf) [explicit]

Definition at line 44 of file ClusterizerFP420.cc.

References conf_, gather_cfg::cout, dn0, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), pn0, rn0, sClusterizerFP420_, sn0, trackerContainers, and verbosity.

                                                               :
    conf_(conf) {
    
    
    std::string alias ( conf.getParameter<std::string>("@module_label") );
    
    produces<ClusterCollectionFP420>().setBranchAlias( alias );
    
    trackerContainers.clear();
    trackerContainers = conf.getParameter<std::vector<std::string> >("ROUList");
    
    verbosity = conf_.getUntrackedParameter<int>("VerbosityLevel");
    dn0   = conf_.getParameter<int>("NumberFP420Detectors");
    sn0   = conf_.getParameter<int>("NumberFP420Stations");
    pn0 = conf_.getParameter<int>("NumberFP420SPlanes");
    rn0 = 7;
    if (verbosity > 0) {
      std::cout << "Creating a ClusterizerFP420" << std::endl;
      std::cout << "ClusterizerFP420: dn0=" << dn0 << " sn0=" << sn0 << " pn0=" << pn0 <<  " rn0=" << rn0 << std::endl;
    }
    
    sClusterizerFP420_ = new FP420ClusterMain(conf_,dn0,sn0,pn0,rn0);
  }
cms::ClusterizerFP420::~ClusterizerFP420 ( ) [virtual]

Definition at line 69 of file ClusterizerFP420.cc.

References sClusterizerFP420_.

                                      { 
    delete sClusterizerFP420_;
  }  

Member Function Documentation

void cms::ClusterizerFP420::beginJob ( void  ) [virtual]

Reimplemented from edm::EDProducer.

Definition at line 74 of file ClusterizerFP420.cc.

References gather_cfg::cout, and verbosity.

                                  {
    if (verbosity > 0) {
      std::cout << "BeginJob method " << std::endl;
    }
    //Getting Calibration data (Noises and BadElectrodes Flag)
    //    bool UseNoiseBadElectrodeFlagFromDB_=conf_.getParameter<bool>("UseNoiseBadElectrodeFlagFromDB");  
    //    if (UseNoiseBadElectrodeFlagFromDB_==true){
    //      iSetup.get<ClusterNoiseFP420Rcd>().get(noise);// AZ: do corrections for noise here
    //=========================================================
    // 
    // Debug: show noise for DetIDs
    //       ElectrodNoiseMapIterator mapit = noise->m_noises.begin();
    //       for (;mapit!=noise->m_noises.end();mapit++)
    //  {
    //    unsigned int detid = (*mapit).first;
    //    std::cout << "detid " <<  detid << " # Electrode " << (*mapit).second.size()<<std::endl;
    //    //ElectrodNoiseVector theElectrodVector =  (*mapit).second;     
    //    const ElectrodNoiseVector theElectrodVector =  noise->getElectrodNoiseVector(detid);
    
    
    //    int electrode=0;
    //    ElectrodNoiseVectorIterator iter=theElectrodVector.begin();
    //    //for(; iter!=theElectrodVector.end(); iter++)
    //    {
    //      std::cout << " electrode " << electrode++ << " =\t"
    //                << iter->getNoise()     << " \t" 
    //                << iter->getDisable()   << " \t" 
    //                << std::endl;         
    //    } 
    //       }
    //===========================================================
    //    }
  }
void cms::ClusterizerFP420::produce ( edm::Event e,
const edm::EventSetup c 
) [virtual]

Implements edm::EDProducer.

Definition at line 108 of file ClusterizerFP420.cc.

References gather_cfg::cout, dn0, Exception, edm::Event::getByLabel(), collect_tpl::input, estimatePileup::inputRange, noise, pn0, edm::Event::put(), rn0, FP420ClusterMain::run(), sClusterizerFP420_, sn0, soutput, theFP420NumberingScheme, trackerContainers, and verbosity.

  {
    //  beginJob;
    // be lazy and include the appropriate namespaces
    using namespace edm; 
    using namespace std;   
    if (verbosity > 0) {
      std::cout << "ClusterizerFP420: produce" << std::endl;
    }
    
    // Get input
    //A
    //   edm::Handle<DigiCollectionFP420> icf_simhit;
    /*    
    Handle<DigiCollectionFP420> cf_simhit;
    std::vector<const DigiCollectionFP420 *> cf_simhitvec;
    for(uint32_t i = 0; i< trackerContainers.size();i++){
      iEvent.getByLabel( trackerContainers[i], cf_simhit);
      cf_simhitvec.push_back(cf_simhit.product());   }
    std::auto_ptr<DigiCollectionFP420 > digis(new DigiCollectionFP420(cf_simhitvec));

    std::vector<HDigiFP420> input;
    DigiCollectionFP420::iterator isim;
    for (isim=digis->begin(); isim!= digis->end();isim++) {
      input.push_back(*isim);
     }
*/    
    //B
           
    Handle<DigiCollectionFP420> input;
    try{
      //      iEvent.getByLabel( "FP420Digi" , digis);
      iEvent.getByLabel( trackerContainers[0] , input);
    } catch(const Exception&)
      {
        // in principal, should never happen, as it's taken care of by Framework
        throw cms::Exception("InvalidReference")
          << "Invalid reference to DigiCollectionFP420 \n";
      }
    
    if (verbosity > 0) {
      std::cout << "ClusterizerFP420: OK1" << std::endl;
    }

    // Step C: create empty output collection
    std::auto_ptr<ClusterCollectionFP420> soutput(new ClusterCollectionFP420);
    /*    
   std::vector<SimVertex> input;
   Handle<DigiCollectionFP420> digis;
   iEvent.getByLabel("FP420Digi",digis);
   input.insert(input.end(),digis->begin(),digis->end());



    std::vector<HDigiFP420> input;
    for(std::vector<HDigiFP420>::const_iterator vsim=digis->begin();
        vsim!=digis->end(); ++vsim){
      input.push_back(*vsim);
    }
   theSimTracks.insert(theSimTracks.end(),SimTk->begin(),SimTk->end());
*/
    //     std::vector<HDigiFP420> input;
    //   DigiCollectionFP420  input;
       //input.push_back(digis);
        //   input.insert(input.end(), digis->begin(), digis->end());

    /*
    std::vector<HDigiFP420> input;
    input.clear();
    DigiCollectionFP420::ContainerIterator sort_begin = digis->begin();
    DigiCollectionFP420::ContainerIterator sort_end = digis->end();
    for ( ;sort_begin != sort_end; ++sort_begin ) {
      input.push_back(*sort_begin);
    } // for
*/
    
    
    //    put zero to container info from the beginning (important! because not any detID is updated with coming of new event     !!!!!!   
    // clean info of container from previous event
      for (int det=1; det<dn0; det++) {
        for (int sector=1; sector<sn0; sector++) {
          for (int zmodule=1; zmodule<pn0; zmodule++) {
            for (int zside=1; zside<rn0; zside++) {
              // intindex is a continues numbering of FP420
              unsigned int detID = theFP420NumberingScheme->FP420NumberingScheme::packMYIndex(rn0, pn0, sn0, det, zside, sector, zmodule);
              std::vector<ClusterFP420> collector;
              collector.clear();
              ClusterCollectionFP420::Range inputRange;
              inputRange.first = collector.begin();
              inputRange.second = collector.end();
              
              soutput->putclear(inputRange,detID);
              
            }//for
          }//for
        }//for
      }//for
      
    
    //                                                                                                                      !!!!!!   
    // if we want to keep Cluster container/Collection for one event --->   uncomment the line below and vice versa
    soutput->clear();   //container_.clear() --> start from the beginning of the container
    
    //                                RUN now:                                                                                 !!!!!!     
    //  sClusterizerFP420_.run(input, soutput, noise);
    if (verbosity > 0) {
      std::cout << "ClusterizerFP420: OK2" << std::endl;
    }
      sClusterizerFP420_->run(input, soutput, noise);

    if (verbosity > 0) {
      std::cout << "ClusterizerFP420: OK3" << std::endl;
    }

    //  if(collectorZS.data.size()>0){

    //  std::cout <<"=======           ClusterizerFP420:                    end of produce     " <<  std::endl;
    
        // Step D: write output to file
        iEvent.put(soutput);
    if (verbosity > 0) {
      std::cout << "ClusterizerFP420: OK4" << std::endl;
    }
  }//produce

Member Data Documentation

Definition at line 55 of file ClusterizerFP420.h.

Referenced by ClusterizerFP420().

Definition at line 66 of file ClusterizerFP420.h.

Referenced by ClusterizerFP420(), and produce().

Definition at line 64 of file ClusterizerFP420.h.

Referenced by produce().

Definition at line 66 of file ClusterizerFP420.h.

Referenced by ClusterizerFP420(), and produce().

Definition at line 66 of file ClusterizerFP420.h.

Referenced by ClusterizerFP420(), and produce().

Definition at line 58 of file ClusterizerFP420.h.

Referenced by ClusterizerFP420(), produce(), and ~ClusterizerFP420().

Definition at line 66 of file ClusterizerFP420.h.

Referenced by ClusterizerFP420(), and produce().

Definition at line 60 of file ClusterizerFP420.h.

Referenced by produce().

Definition at line 62 of file ClusterizerFP420.h.

Referenced by produce().

Definition at line 56 of file ClusterizerFP420.h.

Referenced by ClusterizerFP420(), and produce().

Definition at line 65 of file ClusterizerFP420.h.

Definition at line 67 of file ClusterizerFP420.h.

Referenced by beginJob(), ClusterizerFP420(), and produce().