CMS 3D CMS Logo

Public Member Functions | Private Types | Private Attributes

edm::DataMixingHcalWorker Class Reference

#include <DataMixingHcalWorker.h>

List of all members.

Public Member Functions

void addHcalPileups (const int bcr, const edm::EventPrincipal *, unsigned int EventId)
void addHcalSignals (const edm::Event &e)
 DataMixingHcalWorker (const edm::ParameterSet &ps)
 DataMixingHcalWorker ()
void putHcal (edm::Event &e)
virtual ~DataMixingHcalWorker ()

Private Types

typedef std::multimap< DetId,
HBHERecHit
HBHERecHitMap
typedef std::multimap< DetId,
HFRecHit
HFRecHitMap
typedef std::multimap< DetId,
HORecHit
HORecHitMap
typedef std::multimap< DetId,
ZDCRecHit
ZDCRecHitMap

Private Attributes

edm::InputTag HBHEPileRecHitInputTag_
std::string HBHERecHitCollectionDM_
edm::InputTag HBHErechitCollectionSig_
HBHERecHitMap HBHERecHitStorage_
edm::InputTag HFPileRecHitInputTag_
std::string HFRecHitCollectionDM_
edm::InputTag HFrechitCollectionSig_
HFRecHitMap HFRecHitStorage_
edm::InputTag HOPileRecHitInputTag_
std::string HORecHitCollectionDM_
edm::InputTag HOrechitCollectionSig_
HORecHitMap HORecHitStorage_
std::string label_
edm::InputTag ZDCPileRecHitInputTag_
std::string ZDCRecHitCollectionDM_
edm::InputTag ZDCrechitCollectionSig_
ZDCRecHitMap ZDCRecHitStorage_

Detailed Description

Definition at line 32 of file DataMixingHcalWorker.h.


Member Typedef Documentation

typedef std::multimap<DetId, HBHERecHit> edm::DataMixingHcalWorker::HBHERecHitMap [private]

Definition at line 68 of file DataMixingHcalWorker.h.

typedef std::multimap<DetId, HFRecHit> edm::DataMixingHcalWorker::HFRecHitMap [private]

Definition at line 69 of file DataMixingHcalWorker.h.

typedef std::multimap<DetId, HORecHit> edm::DataMixingHcalWorker::HORecHitMap [private]

Definition at line 70 of file DataMixingHcalWorker.h.

typedef std::multimap<DetId, ZDCRecHit> edm::DataMixingHcalWorker::ZDCRecHitMap [private]

Definition at line 71 of file DataMixingHcalWorker.h.


Constructor & Destructor Documentation

DataMixingHcalWorker::DataMixingHcalWorker ( )

Definition at line 27 of file DataMixingHcalWorker.cc.

{ } 
DataMixingHcalWorker::DataMixingHcalWorker ( const edm::ParameterSet ps) [explicit]

standard constructor

Definition at line 30 of file DataMixingHcalWorker.cc.

References edm::ParameterSet::getParameter(), HBHEPileRecHitInputTag_, HBHERecHitCollectionDM_, HBHErechitCollectionSig_, HFPileRecHitInputTag_, HFRecHitCollectionDM_, HFrechitCollectionSig_, HOPileRecHitInputTag_, HORecHitCollectionDM_, HOrechitCollectionSig_, AlCaHLTBitMon_QueryRunRegistry::string, ZDCPileRecHitInputTag_, ZDCRecHitCollectionDM_, and ZDCrechitCollectionSig_.

                                                                      : 
                                                            label_(ps.getParameter<std::string>("Label"))

  {                                                         

    // get the subdetector names
    //    this->getSubdetectorNames();  //something like this may be useful to check what we are supposed to do...

    // declare the products to produce

    // Hcal 

    HBHErechitCollectionSig_  = ps.getParameter<edm::InputTag>("HBHEProducerSig");
    HOrechitCollectionSig_    = ps.getParameter<edm::InputTag>("HOProducerSig");
    HFrechitCollectionSig_    = ps.getParameter<edm::InputTag>("HFProducerSig");
    ZDCrechitCollectionSig_   = ps.getParameter<edm::InputTag>("ZDCrechitCollectionSig");

    HBHEPileRecHitInputTag_ = ps.getParameter<edm::InputTag>("HBHEPileRecHitInputTag");
    HOPileRecHitInputTag_ = ps.getParameter<edm::InputTag>("HOPileRecHitInputTag");
    HFPileRecHitInputTag_ = ps.getParameter<edm::InputTag>("HFPileRecHitInputTag");
    ZDCPileRecHitInputTag_ = ps.getParameter<edm::InputTag>("ZDCPileRecHitInputTag");

    HBHERecHitCollectionDM_ = ps.getParameter<std::string>("HBHERecHitCollectionDM");
    HORecHitCollectionDM_   = ps.getParameter<std::string>("HORecHitCollectionDM");
    HFRecHitCollectionDM_   = ps.getParameter<std::string>("HFRecHitCollectionDM");
    ZDCRecHitCollectionDM_  = ps.getParameter<std::string>("ZDCRecHitCollectionDM");


  }
DataMixingHcalWorker::~DataMixingHcalWorker ( ) [virtual]

Default destructor

Definition at line 61 of file DataMixingHcalWorker.cc.

                                              { 
  }  

Member Function Documentation

void DataMixingHcalWorker::addHcalPileups ( const int  bcr,
const edm::EventPrincipal ep,
unsigned int  EventId 
)

Definition at line 193 of file DataMixingHcalWorker.cc.

References edm::SortedCollection< T, SORT >::begin(), edm::SortedCollection< T, SORT >::end(), HBHEPileRecHitInputTag_, egHLT::errCodes::HBHERecHits, HBHERecHitStorage_, HFPileRecHitInputTag_, egHLT::errCodes::HFRecHits, HFRecHitStorage_, HOPileRecHitInputTag_, HORecHitStorage_, edm::EventPrincipal::id(), LogDebug, edm::SortedCollection< T, SORT >::size(), ZDCPileRecHitInputTag_, and ZDCRecHitStorage_.

Referenced by edm::DataMixingModule::pileWorker().

                                                                                                         {
  
    LogDebug("DataMixingHcalWorker") <<"\n===============> adding pileups from event  "<<ep->id()<<" for bunchcrossing "<<bcr;

    // fill in maps of hits; same code as addSignals, except now applied to the pileup events

    // HBHE first

    boost::shared_ptr<Wrapper<HBHERecHitCollection>  const> HBHERecHitsPTR =
      getProductByTag<HBHERecHitCollection>(*ep, HBHEPileRecHitInputTag_ );

    if(HBHERecHitsPTR ) {

      const HBHERecHitCollection*  HBHERecHits = const_cast< HBHERecHitCollection * >(HBHERecHitsPTR->product());

      LogDebug("DataMixingEMWorker") << "total # HBHE rechits: " << HBHERecHits->size();

      // loop over digis, adding these to the existing maps                                                     
      for(HBHERecHitCollection::const_iterator it  = HBHERecHits->begin();
          it != HBHERecHits->end(); ++it) {

        HBHERecHitStorage_.insert(HBHERecHitMap::value_type( (it->id()), *it ));

#ifdef DEBUG
        LogDebug("DataMixingEMWorker") << "processed HBHERecHit with rawId: "
                                       << it->id().rawId() << "\n"
                                       << " rechit energy: " << it->energy();
#endif
      }
    }

    // HO Next

    boost::shared_ptr<Wrapper<HORecHitCollection>  const> HORecHitsPTR =
      getProductByTag<HORecHitCollection>(*ep, HOPileRecHitInputTag_ );

    if(HORecHitsPTR ) {

      const HORecHitCollection*  HORecHits = const_cast< HORecHitCollection * >(HORecHitsPTR->product());

      LogDebug("DataMixingEMWorker") << "total # HO rechits: " << HORecHits->size();

      // loop over digis, adding these to the existing maps                                                     
      for(HORecHitCollection::const_iterator it  = HORecHits->begin();
          it != HORecHits->end(); ++it) {

        HORecHitStorage_.insert(HORecHitMap::value_type( (it->id()), *it ));

#ifdef DEBUG
        LogDebug("DataMixingEMWorker") << "processed HORecHit with rawId: "
                                       << it->id().rawId() << "\n"
                                       << " rechit energy: " << it->energy();
#endif
      }
    }

    // HF Next

    boost::shared_ptr<Wrapper<HFRecHitCollection>  const> HFRecHitsPTR =
      getProductByTag<HFRecHitCollection>(*ep, HFPileRecHitInputTag_ );

    if(HFRecHitsPTR ) {

      const HFRecHitCollection*  HFRecHits = const_cast< HFRecHitCollection * >(HFRecHitsPTR->product());

      LogDebug("DataMixingEMWorker") << "total # HF rechits: " << HFRecHits->size();

      // loop over digis, adding these to the existing maps                                                     
      for(HFRecHitCollection::const_iterator it  = HFRecHits->begin();
          it != HFRecHits->end(); ++it) {

        HFRecHitStorage_.insert(HFRecHitMap::value_type( (it->id()), *it ));

#ifdef DEBUG
        LogDebug("DataMixingEMWorker") << "processed HFRecHit with rawId: "
                                       << it->id().rawId() << "\n"
                                       << " rechit energy: " << it->energy();
#endif
      }
    }

    // ZDC Next

    boost::shared_ptr<Wrapper<ZDCRecHitCollection>  const> ZDCRecHitsPTR =
      getProductByTag<ZDCRecHitCollection>(*ep, ZDCPileRecHitInputTag_ );

    if(ZDCRecHitsPTR ) {

      const ZDCRecHitCollection*  ZDCRecHits = const_cast< ZDCRecHitCollection * >(ZDCRecHitsPTR->product());

      LogDebug("DataMixingEMWorker") << "total # ZDC rechits: " << ZDCRecHits->size();

      // loop over digis, adding these to the existing maps                                                     
      for(ZDCRecHitCollection::const_iterator it  = ZDCRecHits->begin();
          it != ZDCRecHits->end(); ++it) {

        ZDCRecHitStorage_.insert(ZDCRecHitMap::value_type( (it->id()), *it ));

#ifdef DEBUG
        LogDebug("DataMixingEMWorker") << "processed ZDCRecHit with rawId: "
                                       << it->id().rawId() << "\n"
                                       << " rechit energy: " << it->energy();
#endif
      }
    }


  }
void DataMixingHcalWorker::addHcalSignals ( const edm::Event e)

Definition at line 64 of file DataMixingHcalWorker.cc.

References edm::SortedCollection< T, SORT >::begin(), edm::SortedCollection< T, SORT >::end(), edm::Event::getByLabel(), HBHErechitCollectionSig_, egHLT::errCodes::HBHERecHits, HBHERecHitStorage_, HFrechitCollectionSig_, egHLT::errCodes::HFRecHits, HFRecHitStorage_, HOrechitCollectionSig_, HORecHitStorage_, edm::EventBase::id(), LogDebug, edm::Handle< T >::product(), edm::SortedCollection< T, SORT >::size(), ZDCrechitCollectionSig_, and ZDCRecHitStorage_.

Referenced by edm::DataMixingModule::addSignals().

                                                             { 
    // fill in maps of hits

    LogInfo("DataMixingHcalWorker")<<"===============> adding MC signals for "<<e.id();

    // HBHE first

   Handle< HBHERecHitCollection > pHBHERecHits;

   const HBHERecHitCollection*  HBHERecHits = 0;

   if( e.getByLabel( HBHErechitCollectionSig_, pHBHERecHits) ) {
     HBHERecHits = pHBHERecHits.product(); // get a ptr to the product
     LogDebug("DataMixingHcalWorker") << "total # HBHE rechits: " << HBHERecHits->size();
   } 
   
 
   if (HBHERecHits)
     {
       // loop over rechits, storing them in a map so we can add pileup later
       for(HBHERecHitCollection::const_iterator it  = HBHERecHits->begin();     
           it != HBHERecHits->end(); ++it) {

         HBHERecHitStorage_.insert(HBHERecHitMap::value_type( ( it->id() ), *it ));
         
#ifdef DEBUG     
         LogDebug("DataMixingHcalWorker") << "processed HBHERecHit with rawId: "
                                      << it->id() << "\n"
                                      << " rechit energy: " << it->energy();
#endif

       }
     }

   // HO next

   Handle< HORecHitCollection > pHORecHits;

   const HORecHitCollection*  HORecHits = 0;

   if( e.getByLabel( HOrechitCollectionSig_, pHORecHits) ){
     HORecHits = pHORecHits.product(); // get a ptr to the product
#ifdef DEBUG
     LogDebug("DataMixingHcalWorker") << "total # HO rechits: " << HORecHits->size();
#endif
   } 
   
 
   if (HORecHits)
     {
       // loop over rechits, storing them in a map so we can add pileup later
       for(HORecHitCollection::const_iterator it  = HORecHits->begin(); 
           it != HORecHits->end(); ++it) {

         HORecHitStorage_.insert(HORecHitMap::value_type( ( it->id() ), *it ));
         
#ifdef DEBUG     
         LogDebug("DataMixingHcalWorker") << "processed HORecHit with rawId: "
                                      << it->id() << "\n"
                                      << " rechit energy: " << it->energy();
#endif

       }
     }

   // HF next

   Handle< HFRecHitCollection > pHFRecHits;

   const HFRecHitCollection*  HFRecHits = 0;

   if( e.getByLabel( HFrechitCollectionSig_, pHFRecHits) ) {
     HFRecHits = pHFRecHits.product(); // get a ptr to the product
#ifdef DEBUG
     LogDebug("DataMixingHcalWorker") << "total # HF rechits: " << HFRecHits->size();
#endif
   } 
   
 
   if (HFRecHits)
     {
       // loop over rechits, storing them in a map so we can add pileup later
       for(HFRecHitCollection::const_iterator it  = HFRecHits->begin(); 
           it != HFRecHits->end(); ++it) {

         HFRecHitStorage_.insert(HFRecHitMap::value_type( ( it->id() ), *it ));
         
#ifdef DEBUG     
         LogDebug("DataMixingHcalWorker") << "processed HFRecHit with rawId: "
                                      << it->id() << "\n"
                                      << " rechit energy: " << it->energy();
#endif

       }
     }

   // ZDC next

   Handle< ZDCRecHitCollection > pZDCRecHits;

   const ZDCRecHitCollection*  ZDCRecHits = 0;

   if( e.getByLabel( ZDCrechitCollectionSig_, pZDCRecHits) ) {
     ZDCRecHits = pZDCRecHits.product(); // get a ptr to the product
#ifdef DEBUG
     LogDebug("DataMixingHcalWorker") << "total # ZDC rechits: " << ZDCRecHits->size();
#endif
   } 
   
 
   if (ZDCRecHits)
     {
       // loop over rechits, storing them in a map so we can add pileup later
       for(ZDCRecHitCollection::const_iterator it  = ZDCRecHits->begin();       
           it != ZDCRecHits->end(); ++it) {

         ZDCRecHitStorage_.insert(ZDCRecHitMap::value_type( ( it->id() ), *it ));
         
#ifdef DEBUG     
         LogDebug("DataMixingHcalWorker") << "processed ZDCRecHit with rawId: "
                                      << it->id() << "\n"
                                      << " rechit energy: " << it->energy();
#endif

       }
     }
    
  } // end of addEMSignals
void DataMixingHcalWorker::putHcal ( edm::Event e)

Definition at line 302 of file DataMixingHcalWorker.cc.

References relval_parameters_module::energy, HBHERecHitCollectionDM_, HBHERecHitStorage_, HFRecHitCollectionDM_, HFRecHitStorage_, HORecHitCollectionDM_, HORecHitStorage_, edm::Event::put(), cond::rpcobgas::time, ZDCRecHitCollectionDM_, and ZDCRecHitStorage_.

Referenced by edm::DataMixingModule::put().

                                                {

    // collection of rechits to put in the event
    std::auto_ptr< HBHERecHitCollection > HBHErechits( new HBHERecHitCollection );
    std::auto_ptr< HORecHitCollection > HOrechits( new HORecHitCollection );
    std::auto_ptr< HFRecHitCollection > HFrechits( new HFRecHitCollection );
    std::auto_ptr< ZDCRecHitCollection > ZDCrechits( new ZDCRecHitCollection );

    // loop over the maps we have, re-making individual hits or digis if necessary.
    DetId formerID = 0;
    DetId currentID;
    float ESum = 0.;
    float HBTime = 0.;

    // HB first...

    HBHERecHitMap::const_iterator iHBchk;

    for(HBHERecHitMap::const_iterator iHB  = HBHERecHitStorage_.begin();
        iHB != HBHERecHitStorage_.end(); ++iHB) {

      currentID = iHB->first; 

      if (currentID == formerID) { // we have to add these rechits together

        ESum+=(iHB->second).energy();  

      }
      else {
        if(formerID>0) {
          // cutoff for ESum?                                                                                 
          HBHERecHit aHit(formerID, ESum, HBTime);
          HBHErechits->push_back( aHit );
        }
        //save pointers for next iteration                                                                    
        formerID = currentID;
        ESum = (iHB->second).energy();
        HBTime = (iHB->second).time();  // take time of first hit in sequence - is this ok?
      }

      iHBchk = iHB;
      if((++iHBchk) == HBHERecHitStorage_.end()) {  //make sure not to lose the last one  
        HBHERecHit aHit(formerID, ESum, HBTime);
        HBHErechits->push_back( aHit );
      }
    }

    // HO next...

    // loop over the maps we have, re-making individual hits or digis if necessary.
    formerID = 0;
    ESum = 0.;
    float HOTime = 0.;

    HORecHitMap::const_iterator iHOchk;

    for(HORecHitMap::const_iterator iHO  = HORecHitStorage_.begin();
        iHO != HORecHitStorage_.end(); ++iHO) {

      currentID = iHO->first; 

      if (currentID == formerID) { // we have to add these rechits together

        ESum+=(iHO->second).energy();  

      }
      else {
        if(formerID>0) {
          // cutoff for ESum?                                                                                 
          HORecHit aHit(formerID, ESum, HOTime);
          HOrechits->push_back( aHit );
        }
        //save pointers for next iteration                                                                    
        formerID = currentID;
        ESum = (iHO->second).energy();
        HOTime = (iHO->second).time();  // take time of first hit in sequence - is this ok?
      }

      iHOchk = iHO;
      if((++iHOchk) == HORecHitStorage_.end()) {  //make sure not to lose the last one  
        HORecHit aHit(formerID, ESum, HOTime);
        HOrechits->push_back( aHit );
      }
    }


    // HF next...

    // loop over the maps we have, re-making individual hits or digis if necessary.
    formerID = 0;
    ESum = 0.;
    float HFTime = 0.;
    HFRecHit HFOldHit;

    HFRecHitMap::const_iterator iHFchk;

    for(HFRecHitMap::const_iterator iHF  = HFRecHitStorage_.begin();
        iHF != HFRecHitStorage_.end(); ++iHF) {

      currentID = iHF->first; 

      if (currentID == formerID) { // we have to add these rechits together

        ESum+=(iHF->second).energy();  

      }
      else {
        if(formerID>0) {
          // cutoff for ESum?                                                                                 
          HFRecHit aHit(formerID, ESum, HFTime);
          HFrechits->push_back( aHit );
        }
        //save pointers for next iteration                                                                    
        formerID = currentID;
        ESum = (iHF->second).energy();
        HFTime = (iHF->second).time();  // take time of first hit in sequence - is this ok?
      }

      iHFchk = iHF;
      if((++iHFchk) == HFRecHitStorage_.end()) {  //make sure not to lose the last one  
        HFRecHit aHit(formerID, ESum, HBTime);
        HFrechits->push_back( aHit );
      }
    }

    // ZDC next...

    // loop over the maps we have, re-making individual hits or digis if necessary.
    formerID = 0;
    ESum = 0.;
    float ZDCTime = 0.;
    float lowGainEnergy = 0;
    ZDCRecHit ZOldHit;

    ZDCRecHitMap::const_iterator iZDCchk;

    for(ZDCRecHitMap::const_iterator iZDC  = ZDCRecHitStorage_.begin();
        iZDC != ZDCRecHitStorage_.end(); ++iZDC) {

      currentID = iZDC->first; 

      if (currentID == formerID) { // we have to add these rechits together

        ESum+=(iZDC->second).energy();  
        
      }
      else {
        if(formerID>0) {
          // cutoff for ESum?                                                                                 
          ZDCRecHit aHit(formerID, ESum, ZDCTime, lowGainEnergy);
          ZDCrechits->push_back( aHit );
        }
        //save pointers for next iteration                                                                    
        formerID = currentID;
        ESum = (iZDC->second).energy();
        lowGainEnergy = (iZDC->second).lowGainEnergy();
        ZDCTime = (iZDC->second).time();  // take time of first hit in sequence - is this ok?
      }
      
      iZDCchk = iZDC;
      if((++iZDCchk) == ZDCRecHitStorage_.end()) {  //make sure not to lose the last one  
        ZDCRecHit aHit(formerID, ESum, HBTime, lowGainEnergy);
        ZDCrechits->push_back( aHit );
      }
    } 
  
   //done merging

    // put the collection of recunstructed hits in the event   
    LogInfo("DataMixingHcalWorker") << "total # HBHE Merged rechits: " << HBHErechits->size() ;
    LogInfo("DataMixingHcalWorker") << "total # HO Merged rechits: " << HOrechits->size() ;
    LogInfo("DataMixingHcalWorker") << "total # HF Merged rechits: " << HFrechits->size() ;
    LogInfo("DataMixingHcalWorker") << "total # ZDC Merged rechits: " << ZDCrechits->size() ;

    e.put( HBHErechits, HBHERecHitCollectionDM_ );
    e.put( HOrechits, HORecHitCollectionDM_ );
    e.put( HFrechits, HFRecHitCollectionDM_ );
    e.put( ZDCrechits, ZDCRecHitCollectionDM_ );

    // clear local storage after this event
    HBHERecHitStorage_.clear();
    HORecHitStorage_.clear();
    HFRecHitStorage_.clear();
    ZDCRecHitStorage_.clear();

  }

Member Data Documentation

Definition at line 58 of file DataMixingHcalWorker.h.

Referenced by addHcalPileups(), and DataMixingHcalWorker().

Definition at line 63 of file DataMixingHcalWorker.h.

Referenced by DataMixingHcalWorker(), and putHcal().

Definition at line 53 of file DataMixingHcalWorker.h.

Referenced by addHcalSignals(), and DataMixingHcalWorker().

Definition at line 73 of file DataMixingHcalWorker.h.

Referenced by addHcalPileups(), addHcalSignals(), and putHcal().

Definition at line 60 of file DataMixingHcalWorker.h.

Referenced by addHcalPileups(), and DataMixingHcalWorker().

Definition at line 65 of file DataMixingHcalWorker.h.

Referenced by DataMixingHcalWorker(), and putHcal().

Definition at line 55 of file DataMixingHcalWorker.h.

Referenced by addHcalSignals(), and DataMixingHcalWorker().

Definition at line 74 of file DataMixingHcalWorker.h.

Referenced by addHcalPileups(), addHcalSignals(), and putHcal().

Definition at line 59 of file DataMixingHcalWorker.h.

Referenced by addHcalPileups(), and DataMixingHcalWorker().

Definition at line 64 of file DataMixingHcalWorker.h.

Referenced by DataMixingHcalWorker(), and putHcal().

Definition at line 54 of file DataMixingHcalWorker.h.

Referenced by addHcalSignals(), and DataMixingHcalWorker().

Definition at line 75 of file DataMixingHcalWorker.h.

Referenced by addHcalPileups(), addHcalSignals(), and putHcal().

std::string edm::DataMixingHcalWorker::label_ [private]

Definition at line 81 of file DataMixingHcalWorker.h.

Definition at line 61 of file DataMixingHcalWorker.h.

Referenced by addHcalPileups(), and DataMixingHcalWorker().

Definition at line 66 of file DataMixingHcalWorker.h.

Referenced by DataMixingHcalWorker(), and putHcal().

Definition at line 56 of file DataMixingHcalWorker.h.

Referenced by addHcalSignals(), and DataMixingHcalWorker().

Definition at line 76 of file DataMixingHcalWorker.h.

Referenced by addHcalPileups(), addHcalSignals(), and putHcal().