CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

edm::SecSourceAnalyzer Class Reference

#include <SecSourceAnalyzer.h>

Inheritance diagram for edm::SecSourceAnalyzer:
edm::EDAnalyzer

List of all members.

Public Member Functions

virtual void dummyFunction (EventPrincipal const &ep)
virtual void getBranches (EventPrincipal const &ep)
 SecSourceAnalyzer (const edm::ParameterSet &)
 ~SecSourceAnalyzer ()

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
virtual void beginJob ()
virtual void endJob ()

Private Attributes

bool dataStep2_
boost::shared_ptr< PileUpinput_
edm::InputTag label_
int maxBunch_
int minBunch_
InputTag tag_
std::vector< float > TrueNumInteractions_ [5]
std::vector< std::vector
< edm::EventID > > 
vectorEventIDs_

Detailed Description

Definition at line 42 of file SecSourceAnalyzer.h.


Constructor & Destructor Documentation

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

Definition at line 52 of file SecSourceAnalyzer.cc.

References dataStep2_, edm::ParameterSet::getParameter(), diJetCalib::histoFileName, input_, label_, and Playback_cff::playback.

  :minBunch_(0),
   maxBunch_(0),
   tag_(InputTag())
{
//    int minb = minBunch_;
//    int maxb = maxBunch_;
   int averageNumber = 1;
   std::string histoFileName = " ";
   TH1F * histoName = new TH1F("h","",10,0,10); 
   bool playback = false;
   
   input_.reset(new edm::PileUp(iConfig.getParameter<edm::ParameterSet>("input"),
                                averageNumber,histoName,playback));
      
   dataStep2_ = iConfig.getParameter<bool>("dataStep2");
   
   
   if (dataStep2_)
     // The data file contain the PCrossingFrame<SimTrack>
     label_   = iConfig.getParameter<edm::InputTag>("collPCF");
   else
     // The data file contain the SimTrack
     label_   = iConfig.getParameter<edm::InputTag>("collSimTrack");

}
SecSourceAnalyzer::~SecSourceAnalyzer ( )

Definition at line 80 of file SecSourceAnalyzer.cc.

{
}

Member Function Documentation

void SecSourceAnalyzer::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDAnalyzer.

Definition at line 91 of file SecSourceAnalyzer.cc.

References gather_cfg::cout, dummyFunction(), getBranches(), input_, maxBunch_, minBunch_, and vectorEventIDs_.

{
   vectorEventIDs_.resize(maxBunch_-minBunch_+1);

   int nevt = 0 ;
   for( int ibx = minBunch_ ; ibx <= maxBunch_ ; ++ibx )
     {
       if( ibx == 0 )
         {
           input_->readPileUp( vectorEventIDs_[ ibx-minBunch_ ],
                               boost::bind(&SecSourceAnalyzer::getBranches, 
                                           this, _1), ibx
                               );
         }
       else
         {
           input_->readPileUp( vectorEventIDs_[ ibx-minBunch_ ],
                               boost::bind(&SecSourceAnalyzer::dummyFunction, 
                                           this, _1), ibx
                               );
         }

       nevt += vectorEventIDs_[ ibx-minBunch_ ].size() ;
     }

   std::cout << "-> The std::vector<EventPrincipalVector> of the secondary source 'input' has been filled with " 
             << nevt << " element corresponding to " << maxBunch_-minBunch_+1 
             << " bunch." << std::endl;
}
void SecSourceAnalyzer::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 163 of file SecSourceAnalyzer.cc.

{
}
virtual void edm::SecSourceAnalyzer::dummyFunction ( EventPrincipal const &  ep) [inline, virtual]

Definition at line 49 of file SecSourceAnalyzer.h.

Referenced by analyze().

{}
void SecSourceAnalyzer::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 169 of file SecSourceAnalyzer.cc.

References input_.

                          {
  if (input_) input_->endJob();
}
void SecSourceAnalyzer::getBranches ( EventPrincipal const &  ep) [virtual]

Definition at line 121 of file SecSourceAnalyzer.cc.

References gather_cfg::cout, dataStep2_, edm::EventPrincipal::id(), label_, edm::Principal::size(), and tag_.

Referenced by analyze().

  { 
    std::cout <<"-> Get the event:  id " << ep.id() << std::endl;
    std::cout << "-> dataStep2_ = " << dataStep2_ << std::endl;
    tag_ = InputTag(label_);
    
    std::cout << "-> Will try to get the branch with the tag : " << tag_ << std::endl;    
    std::cout << " and the EventPrincipal ep with a size = " << ep.size() << std::endl;
    
    if (!dataStep2_){
        // Get the SimTrack collection
        
        // default version changed to transmit vertexoffset
        boost::shared_ptr<Wrapper<std::vector<SimTrack> > const> shPtr =
        getProductByTag<std::vector<SimTrack> >(ep, tag_);
    
        if (shPtr) 
                std::cout << "-> Could get SimTrack !" << std::endl;
        else 
                std::cout << "-> Could not get SimTrack !" << std::endl;

    }
    else{
        // Get the PCrossingFrame collection given as signal
    
        // default version changed to transmit vertexoffset
        tag_ = InputTag("CFwriter","g4SimHits");
        boost::shared_ptr<Wrapper<PCrossingFrame<SimTrack> > const> shPtr =
        getProductByTag<PCrossingFrame<SimTrack> >(ep, tag_);
        
        if (shPtr) 
                std::cout << "-> Could get PCrossingFrame<SimTrack> !" << std::endl;
        else 
                std::cout << "-> Could not get PCrossingFrame<SimTrack> !" << std::endl;
        
    }
 
  }

Member Data Documentation

Definition at line 60 of file SecSourceAnalyzer.h.

Referenced by getBranches(), and SecSourceAnalyzer().

boost::shared_ptr<PileUp> edm::SecSourceAnalyzer::input_ [private]

Definition at line 65 of file SecSourceAnalyzer.h.

Referenced by analyze(), endJob(), and SecSourceAnalyzer().

Definition at line 61 of file SecSourceAnalyzer.h.

Referenced by getBranches(), and SecSourceAnalyzer().

Definition at line 58 of file SecSourceAnalyzer.h.

Referenced by analyze().

Definition at line 57 of file SecSourceAnalyzer.h.

Referenced by analyze().

Definition at line 68 of file SecSourceAnalyzer.h.

Referenced by getBranches().

std::vector< float > edm::SecSourceAnalyzer::TrueNumInteractions_[5] [private]

Definition at line 66 of file SecSourceAnalyzer.h.

std::vector<std::vector<edm::EventID> > edm::SecSourceAnalyzer::vectorEventIDs_ [private]

Definition at line 63 of file SecSourceAnalyzer.h.

Referenced by analyze().