CMS 3D CMS Logo

Public Types | 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 Types

typedef
PileUp::EventPrincipalVector 
EventPrincipalVector

Public Member Functions

virtual void getBranches (EventPrincipal *ep)
virtual void Loop (const EventPrincipalVector &vec)
 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_
std::vector< EventPrincipalVectorpileup_ [5]
InputTag tag_
std::vector< std::vector
< edm::EventID > > 
vectorEventIDs_

Detailed Description

Definition at line 42 of file SecSourceAnalyzer.h.


Member Typedef Documentation

Definition at line 45 of file SecSourceAnalyzer.h.


Constructor & Destructor Documentation

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

Definition at line 51 of file SecSourceAnalyzer.cc.

References dataStep2_, edm::ParameterSet::getParameter(), diJetCalib::histoFileName, input_, label_, maxBunch_, minBunch_, 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"),minb,maxb,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 78 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 89 of file SecSourceAnalyzer.cc.

References gather_cfg::cout, input_, Loop(), maxBunch_, minBunch_, pileup_, and vectorEventIDs_.

{

   vectorEventIDs_.resize(maxBunch_-minBunch_+1);
   
   input_->readPileUp(pileup_[0],vectorEventIDs_);
   
   std::cout << "-> The std::vector<EventPrincipalVector> of the secondary source 'input' has been filled with " 
             << pileup_[0].size() << " element corresponding to " << maxBunch_-minBunch_+1 
             << " bunch." << std::endl;
  
   // Run for one source (input) and the bunch 0
   Loop(pileup_[0][0]);
}
void SecSourceAnalyzer::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 160 of file SecSourceAnalyzer.cc.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 166 of file SecSourceAnalyzer.cc.

References input_.

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

Definition at line 119 of file SecSourceAnalyzer.cc.

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

Referenced by Loop().

  { 
    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;
        
    }
 
  }
void SecSourceAnalyzer::Loop ( const EventPrincipalVector vec) [virtual]

Definition at line 105 of file SecSourceAnalyzer.cc.

References gather_cfg::cout, and getBranches().

Referenced by analyze().

                                                            {
    //
    // loop over events
    //
    std::cout <<"-> Loop over EventPrincipalVector wich size is "<< vec.size() << "." << std::endl;
    
    for (EventPrincipalVector::const_iterator it = vec.begin(); it != vec.end(); ++it) {
      std::cout <<"-> Get the event:  id " << (*it)->id() << std::endl;

      getBranches(&(**it));
    }
}

Member Data Documentation

Definition at line 63 of file SecSourceAnalyzer.h.

Referenced by getBranches(), and SecSourceAnalyzer().

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

Definition at line 68 of file SecSourceAnalyzer.h.

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

Definition at line 64 of file SecSourceAnalyzer.h.

Referenced by getBranches(), and SecSourceAnalyzer().

Definition at line 61 of file SecSourceAnalyzer.h.

Referenced by analyze(), and SecSourceAnalyzer().

Definition at line 60 of file SecSourceAnalyzer.h.

Referenced by analyze(), and SecSourceAnalyzer().

Definition at line 70 of file SecSourceAnalyzer.h.

Referenced by analyze().

Definition at line 72 of file SecSourceAnalyzer.h.

Referenced by getBranches().

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

Definition at line 66 of file SecSourceAnalyzer.h.

Referenced by analyze().