CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10/src/RecoRomanPot/RecoFP420/plugins/TrackerizerFP420.cc

Go to the documentation of this file.
00001 
00002 // File: TrackerizerFP420.cc
00003 // Date: 12.2006
00004 // Description: TrackerizerFP420 for FP420
00005 // Modifications: 
00007 #include <memory>
00008 #include <string>
00009 #include "FWCore/Framework/interface/Frameworkfwd.h"
00010 #include "FWCore/Framework/interface/EDProducer.h"
00011 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00012 #include "FWCore/Framework/interface/Event.h"
00013 #include "FWCore/Framework/interface/MakerMacros.h"
00014 #include "FWCore/Framework/interface/EventSetup.h"
00015 #include "FWCore/Framework/interface/ESHandle.h"
00016 
00017 #include "RecoRomanPot/RecoFP420/interface/TrackerizerFP420.h"
00018 #include "DataFormats/FP420Cluster/interface/ClusterCollectionFP420.h"
00019 #include "DataFormats/FP420Cluster/interface/TrackCollectionFP420.h"
00020 
00021 #include <iostream> 
00022 using namespace std;
00023 
00024 //
00025 namespace cms
00026 {
00027   TrackerizerFP420::TrackerizerFP420(const edm::ParameterSet& conf):conf_(conf)     {
00028     
00029     std::string alias ( conf.getParameter<std::string>("@module_label") );
00030     
00031     produces<TrackCollectionFP420>().setBranchAlias( alias );
00032     
00033     trackerContainers.clear();
00034     trackerContainers = conf.getParameter<std::vector<std::string> >("ROUList");
00035     
00036     verbosity = conf_.getUntrackedParameter<int>("VerbosityLevel");
00037     if (verbosity > 0) {
00038       std::cout << "Creating a TrackerizerFP420" << std::endl;
00039     }
00040     
00041     // Initialization:
00042     sFP420TrackMain_ = new FP420TrackMain(conf_);
00043     
00044   }
00045   
00046   // Virtual destructor needed.
00047   TrackerizerFP420::~TrackerizerFP420() {
00048     delete sFP420TrackMain_;
00049   }  
00050   
00051   //Get at the beginning
00052   void TrackerizerFP420::beginJob() {
00053     if (verbosity > 0) {
00054       std::cout << "BeginJob method " << std::endl;
00055     }
00056   }
00057   
00058   
00059   void TrackerizerFP420::produce(edm::Event& iEvent, const edm::EventSetup& iSetup)
00060   {
00061     //  beginJob;
00062     // be lazy and include the appropriate namespaces
00063     using namespace edm; 
00064     using namespace std;   
00065     
00066     // Get input
00067     //A
00068     //   edm::Handle<ClusterCollectionFP420> icf_simhit;
00069     /*
00070     Handle<ClusterCollectionFP420> cf_simhit;
00071     std::vector<const ClusterCollectionFP420 *> cf_simhitvec;
00072     for(uint32_t i = 0; i< trackerContainers.size();i++){
00073       iEvent.getByLabel( trackerContainers[i], cf_simhit);
00074       cf_simhitvec.push_back(cf_simhit.product());   }
00075     std::auto_ptr<ClusterCollectionFP420 > input(new DigiCollectionFP420(cf_simhitvec));
00076     */   
00077     
00078     //B
00079     
00080       Handle<ClusterCollectionFP420> input;
00081       iEvent.getByLabel( trackerContainers[0] , input);
00082 
00083 
00084        
00085     
00086     // Step C: create empty output collection
00087     std::auto_ptr<TrackCollectionFP420> toutput(new TrackCollectionFP420);
00088     
00089     
00090     
00091     //    put zero to container info from the beginning (important! because not any detID is updated with coming of new event     !!!!!!   
00092     // clean info of container from previous event
00093     
00094     std::vector<TrackFP420> collector;
00095     collector.clear();
00096     TrackCollectionFP420::Range inputRange;
00097     inputRange.first = collector.begin();
00098     inputRange.second = collector.end();
00099     
00100     unsigned int detID = 0;
00101     toutput->putclear(inputRange,detID);
00102     
00103     unsigned  int StID = 1111;
00104     toutput->putclear(inputRange,StID);
00105     StID = 2222;
00106     toutput->putclear(inputRange,StID);
00107     
00108     
00109     //                                                                                                                      !!!!!!   
00110     // if we want to keep Track container/Collection for one event --->   uncomment the line below and vice versa
00111     toutput->clear();   //container_.clear() --> start from the beginning of the container
00112     
00113     //                                RUN now:                                                                                 !!!!!!     
00114     //   startFP420TrackMain_.run(input, toutput);
00115     sFP420TrackMain_->run(input, toutput);
00116     // std::cout <<"=======           TrackerizerFP420:                    end of produce     " << std::endl;
00117     
00118         // Step D: write output to file
00119         iEvent.put(toutput);
00120   }//produce
00121   
00122 } // namespace cms
00123 
00124