#include <EcalTBReadout.h>
Public Member Functions | |
EcalTBReadout (const std::string theEcalTBInfoLabel) | |
void | findTTlist (const int &crysId, const EcalTrigTowerConstituentsMap &etmap) |
search for the TT to be read | |
void | performReadout (edm::Event &event, const EcalTrigTowerConstituentsMap &theTTmap, EEDigiCollection &input, EEDigiCollection &output) |
master function to be called once per event | |
void | performReadout (edm::Event &event, const EcalTrigTowerConstituentsMap &theTTmap, EBDigiCollection &input, EBDigiCollection &output) |
master function to be called once per event | |
void | readOut (EBDigiCollection &input, EBDigiCollection &output, const EcalTrigTowerConstituentsMap &etmap) |
read only the digis from the selected TT | |
void | readOut (EEDigiCollection &input, EEDigiCollection &output, const EcalTrigTowerConstituentsMap &etmap) |
read only the digis from the selected TT | |
void | setDetIds (const std::vector< DetId > &detIds) |
tell the readout which cells exist | |
~EcalTBReadout () | |
Private Attributes | |
std::string | ecalTBInfoLabel_ |
const std::vector< DetId > * | theDetIds |
int | theTargetCrystal_ |
std::vector< EcalTrigTowerDetId > | theTTlist_ |
Static Private Attributes | |
static const int | NCRYMATRIX = 7 |
Definition at line 20 of file EcalTBReadout.h.
EcalTBReadout::EcalTBReadout | ( | const std::string | theEcalTBInfoLabel | ) |
Definition at line 8 of file EcalTBReadout.cc.
References theTargetCrystal_, and theTTlist_.
: ecalTBInfoLabel_(theEcalTBInfoLabel) { theTargetCrystal_ = -1; theTTlist_.reserve(1); }
EcalTBReadout::~EcalTBReadout | ( | ) | [inline] |
Definition at line 28 of file EcalTBReadout.h.
{};
void EcalTBReadout::findTTlist | ( | const int & | crysId, |
const EcalTrigTowerConstituentsMap & | etmap | ||
) |
search for the TT to be read
step 1: find the correspondence between the crystal identified in module and its DetId assuming only 1 SM present
step 2: find the crystals in the matrix and fill the TT list
loop on all the valid DetId and search for the good ones
Definition at line 16 of file EcalTBReadout.cc.
References Exception, spr::find(), newFWLiteAna::found, i, EBDetId::ic(), EBDetId::ieta(), EBDetId::iphi(), LogDebug, NCRYMATRIX, findQualityFiles::size, theDetIds, theTargetCrystal_, theTTlist_, and EcalTrigTowerConstituentsMap::towerOf().
Referenced by performReadout().
{ // search for the TT involved in the NCRYMATRIX x NCRYMATRIX // around the target crystal if a new target, otherwise use // the list already filled if ( crysId == theTargetCrystal_ ) { return; } theTTlist_.clear(); EBDetId theTargetId; std::vector<DetId>::const_iterator idItr = theDetIds->begin(); unsigned int ncount = 0; bool found = false; while ( (ncount < theDetIds->size()) && !found ) { EBDetId thisEBdetid(idItr->rawId()); if (thisEBdetid.ic() == crysId) { theTargetId = thisEBdetid; found = true; } ++idItr; ++ncount; } if ( !found ) { throw cms::Exception("ObjectNotFound", "Ecal TB target crystal not found in geometry"); return; } theTargetCrystal_ = theTargetId.ic(); int myEta = theTargetId.ieta(); int myPhi = theTargetId.iphi(); for ( int icrysEta = (myEta-(NCRYMATRIX-1)/2) ; icrysEta <= (myEta+(NCRYMATRIX-1)/2) ; ++icrysEta ) { for ( int icrysPhi = (myPhi-(NCRYMATRIX-1)/2) ; icrysPhi <= (myPhi+(NCRYMATRIX-1)/2) ; ++icrysPhi ) { EBDetId thisEBdetid; idItr = theDetIds->begin(); ncount = 0; found = false; while ( (ncount < theDetIds->size()) && !found ) { EBDetId myEBdetid(idItr->rawId()); if ( (myEBdetid.ieta() == icrysEta) && (myEBdetid.iphi() == icrysPhi) ) { thisEBdetid = myEBdetid; found = true; } ++idItr; ++ncount; } if ( found ) { EcalTrigTowerDetId thisTTdetId=etmap.towerOf(thisEBdetid); LogDebug("EcalDigi") << "Crystal to be readout: sequential id = " << thisEBdetid.ic() << " eta = " << icrysEta << " phi = " << icrysPhi << " from TT = " << thisTTdetId; if ( theTTlist_.size() == 0 || ( theTTlist_.size() == 1 && theTTlist_[0] != thisTTdetId )) { theTTlist_.push_back(thisTTdetId); } else { std::vector<EcalTrigTowerDetId>::iterator ttFound = find(theTTlist_.begin(), theTTlist_.end(), thisTTdetId); if ( theTTlist_.size() > 1 && ttFound == theTTlist_.end() && *(theTTlist_.end()) != thisTTdetId ) { theTTlist_.push_back(thisTTdetId); } } } } } edm::LogInfo("EcalDigi") << " TT to be read: "; for ( unsigned int i = 0 ; i < theTTlist_.size() ; ++i ) { edm::LogInfo("EcalDigi") << " TT " << i << " " << theTTlist_[i]; } }
void EcalTBReadout::performReadout | ( | edm::Event & | event, |
const EcalTrigTowerConstituentsMap & | theTTmap, | ||
EBDigiCollection & | input, | ||
EBDigiCollection & | output | ||
) |
master function to be called once per event
Definition at line 165 of file EcalTBReadout.cc.
References ecalTBInfoLabel_, findTTlist(), and readOut().
Referenced by EcalTBDigiProducer::produce().
{ // TB readout // step 1: get the target crystal index edm::Handle<PEcalTBInfo> theEcalTBInfo; event.getByLabel(ecalTBInfoLabel_,theEcalTBInfo); int crysId = theEcalTBInfo->nCrystal(); // step 2: update (if needed) the TT list to be read findTTlist(crysId, theTTmap); // step 3: perform the readout readOut(input, output, theTTmap); }
void EcalTBReadout::performReadout | ( | edm::Event & | event, |
const EcalTrigTowerConstituentsMap & | theTTmap, | ||
EEDigiCollection & | input, | ||
EEDigiCollection & | output | ||
) |
master function to be called once per event
Definition at line 186 of file EcalTBReadout.cc.
References ecalTBInfoLabel_, findTTlist(), and readOut().
{ // TB readout // step 1: get the target crystal index edm::Handle<PEcalTBInfo> theEcalTBInfo; event.getByLabel(ecalTBInfoLabel_,theEcalTBInfo); int crysId = theEcalTBInfo->nCrystal(); // step 2: update (if needed) the TT list to be read findTTlist(crysId, theTTmap); // step 3: perform the readout readOut(input, output, theTTmap); }
void EcalTBReadout::readOut | ( | EBDigiCollection & | input, |
EBDigiCollection & | output, | ||
const EcalTrigTowerConstituentsMap & | etmap | ||
) |
read only the digis from the selected TT
Definition at line 107 of file EcalTBReadout.cc.
References edm::DataFrameContainer::back(), edm::DataFrame::begin(), filterCSVwithJSON::copy, edm::DataFrame::end(), spr::find(), EcalDataFrame::frame(), EBDataFrame::id(), edm::DataFrameContainer::push_back(), edm::DataFrameContainer::size(), theTTlist_, and EcalTrigTowerConstituentsMap::towerOf().
Referenced by performReadout().
{ /* for(EBDigiCollection::const_iterator digiItr = input.begin(); digiItr != input.end(); ++digiItr) { EcalTrigTowerDetId thisTTdetId=etmap.towerOf(digiItr->id()); std::vector<EcalTrigTowerDetId>::iterator ttFound = find(theTTlist_.begin(), theTTlist_.end(), thisTTdetId); if ((ttFound != theTTlist_.end()) || *(theTTlist_.end()) == thisTTdetId) { output.push_back(*digiItr); } } edm::LogInfo("EcalDigi") << "Read EB Digis: " << output.size(); */ for (unsigned int digis=0; digis<input.size(); ++digis){ EBDataFrame ebdf = input[digis]; EcalTrigTowerDetId thisTTdetId=etmap.towerOf(ebdf.id()); std::vector<EcalTrigTowerDetId>::iterator ttFound = find(theTTlist_.begin(), theTTlist_.end(), thisTTdetId); if ((ttFound != theTTlist_.end()) || *(theTTlist_.end()) == thisTTdetId) { output.push_back( ebdf.id() ) ; EBDataFrame ebdf2( output.back() ); std::copy( ebdf.frame().begin(), ebdf.frame().end(), ebdf2.frame().begin() ); } } }
void EcalTBReadout::readOut | ( | EEDigiCollection & | input, |
EEDigiCollection & | output, | ||
const EcalTrigTowerConstituentsMap & | etmap | ||
) |
read only the digis from the selected TT
Definition at line 140 of file EcalTBReadout.cc.
References edm::DataFrameContainer::back(), edm::DataFrame::begin(), filterCSVwithJSON::copy, edm::DataFrame::end(), spr::find(), EcalDataFrame::frame(), EEDataFrame::id(), edm::DataFrameContainer::push_back(), edm::DataFrameContainer::size(), theTTlist_, and EcalTrigTowerConstituentsMap::towerOf().
{ for (unsigned int digis=0; digis<input.size(); ++digis) { EEDataFrame eedf ( input[digis] ) ; EcalTrigTowerDetId thisTTdetId ( etmap.towerOf( eedf.id() ) ) ; std::vector<EcalTrigTowerDetId>::iterator ttFound ( find(theTTlist_.begin(), theTTlist_.end(), thisTTdetId ) ) ; if( ( ttFound != theTTlist_.end() ) || *(theTTlist_.end()) == thisTTdetId ) { output.push_back( eedf.id() ) ; EEDataFrame eedf2( output.back() ) ; std::copy( eedf.frame().begin(), eedf.frame().end(), eedf2.frame().begin() ); } } }
void EcalTBReadout::setDetIds | ( | const std::vector< DetId > & | detIds | ) | [inline] |
tell the readout which cells exist
Definition at line 31 of file EcalTBReadout.h.
References theDetIds.
Referenced by EcalTBDigiProducer::produce().
{theDetIds = &detIds;}
std::string EcalTBReadout::ecalTBInfoLabel_ [private] |
Definition at line 58 of file EcalTBReadout.h.
Referenced by performReadout().
const int EcalTBReadout::NCRYMATRIX = 7 [static, private] |
Definition at line 54 of file EcalTBReadout.h.
Referenced by findTTlist().
const std::vector<DetId>* EcalTBReadout::theDetIds [private] |
Definition at line 56 of file EcalTBReadout.h.
Referenced by findTTlist(), and setDetIds().
int EcalTBReadout::theTargetCrystal_ [private] |
Definition at line 50 of file EcalTBReadout.h.
Referenced by EcalTBReadout(), and findTTlist().
std::vector<EcalTrigTowerDetId> EcalTBReadout::theTTlist_ [private] |
Definition at line 52 of file EcalTBReadout.h.
Referenced by EcalTBReadout(), findTTlist(), and readOut().