CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
SiStripShotFilter Class Reference
Inheritance diagram for SiStripShotFilter:
edm::EDFilter edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 SiStripShotFilter (const edm::ParameterSet &)
 
 ~SiStripShotFilter ()
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDFilter ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void beginJob () override
 
virtual void endJob () override
 
virtual bool filter (edm::Event &, const edm::EventSetup &) override
 
void updateCabling (const edm::EventSetup &eventSetup)
 

Private Attributes

const SiStripFedCablingcabling_
 
uint32_t cablingCacheId_
 
edm::InputTag digicollection_
 
edm::EDGetTokenT
< edm::DetSetVector
< SiStripDigi > > 
digiToken_
 
std::ofstream fOut_
 
std::string fOutPath_
 
bool zs_
 

Additional Inherited Members

- Public Types inherited from edm::EDFilter
typedef EDFilter ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDFilter
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 53 of file SiStripShotFilter.cc.

Constructor & Destructor Documentation

SiStripShotFilter::SiStripShotFilter ( const edm::ParameterSet iConfig)
explicit

Definition at line 86 of file SiStripShotFilter.cc.

References digicollection_, and digiToken_.

87  : fOutPath_(iConfig.getUntrackedParameter<std::string>("OutputFilePath","shotChannels.dat")),
88  cablingCacheId_(0),
89  digicollection_(iConfig.getParameter<edm::InputTag>("DigiCollection")),
90  zs_(iConfig.getUntrackedParameter<bool>("ZeroSuppressed",true))
91 
92 {
93 
94  digiToken_ = consumes<edm::DetSetVector<SiStripDigi> >(digicollection_);
95 
96 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::InputTag digicollection_
edm::EDGetTokenT< edm::DetSetVector< SiStripDigi > > digiToken_
SiStripShotFilter::~SiStripShotFilter ( )

Definition at line 98 of file SiStripShotFilter.cc.

99 {
100 }

Member Function Documentation

void SiStripShotFilter::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDFilter.

Definition at line 168 of file SiStripShotFilter.cc.

References gather_cfg::cout, fOut_, fOutPath_, and dbtoconf::out.

169 {
170  fOut_.open(fOutPath_.c_str(),std::ios::out);
171  if (!fOut_) std::cout << " WARNING ! Cannot open file " << fOutPath_ << " for writting. List of shot channels will not be saved." << std::endl;
172 }
tuple out
Definition: dbtoconf.py:99
tuple cout
Definition: gather_cfg.py:121
void SiStripShotFilter::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDFilter.

Definition at line 176 of file SiStripShotFilter.cc.

References fOut_.

177 {
178 
179  fOut_.close();
180 
181 }
bool SiStripShotFilter::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDFilter.

Definition at line 109 of file SiStripShotFilter.cc.

References FedChannelConnection::apvPairNumber(), cabling_, FedChannelConnection::detId(), digiToken_, edm::EventID::event(), sistrip::FEDCH_PER_FED, SiStripFedCabling::fedConnection(), HLT_25ns14e33_v1_cff::fedId, fOut_, edm::Event::getByToken(), APVShotFinder::getShots(), edm::EventBase::id(), FEDNumbering::MAXSiStripFEDID, FEDNumbering::MINSiStripFEDID, updateCabling(), and zs_.

Referenced by Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::filter(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::find(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::setDataAccessor(), and Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::switchCenterView().

111 {
112 
113  //update cabling
114  updateCabling(iSetup);
115 
116  //get digi data
118  iEvent.getByToken(digiToken_,digis);
119 
120  // loop on detector with digis
121 
122  APVShotFinder apvsf(*digis,zs_);
123  const std::vector<APVShot>& shots = apvsf.getShots();
124 
125  //loop on feds first: there should be only a small number of shots...
126  //better to loop only once on all channels....
127  //to be able to output both fed/ch and module/APV.
128 
129  unsigned int lShots = 0;
130 
131  for (unsigned int fedId = FEDNumbering::MINSiStripFEDID;
133  fedId++) {//loop over FED IDs
134 
135  for (unsigned int iCh = 0;
136  iCh < sistrip::FEDCH_PER_FED;
137  iCh++) {//loop on channels
138 
139  const FedChannelConnection & lConnection = cabling_->fedConnection(fedId,iCh);
140 
141  uint32_t lDetId = lConnection.detId();
142  short lAPVPair = lConnection.apvPairNumber();
143 
144  for(std::vector<APVShot>::const_iterator shot=shots.begin();shot!=shots.end();++shot) {//loop on shots
145 
146  if (shot->detId() == lDetId &&
147  static_cast<short>(shot->apvNumber()/2.) == lAPVPair)
148  {
149  if(shot->isGenuine()) {//genuine shot
150 
151  fOut_ << fedId << " " << iCh << " " << shot->detId() << " " << shot->apvNumber() << std::endl;
152  lShots++;
153  }//genuine shot
154  if (shot->apvNumber()%2==1) break;
155  }
156  }//loop on shots
157  }//loop on channels
158  }//loop on FEDs.
159 
160  if (lShots > 0) fOut_ << "### " << iEvent.id().event() << " " << lShots << std::endl;
161 
162  return lShots;
163 
164 }//analyze method
EventNumber_t event() const
Definition: EventID.h:41
const SiStripFedCabling * cabling_
FedChannelConnection fedConnection(uint16_t fed_id, uint16_t fed_ch) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
uint16_t apvPairNumber() const
void updateCabling(const edm::EventSetup &eventSetup)
const uint32_t & detId() const
Class containning control, module, detector and connection information, at the level of a FED channel...
edm::EventID id() const
Definition: EventBase.h:60
static const uint16_t FEDCH_PER_FED
edm::EDGetTokenT< edm::DetSetVector< SiStripDigi > > digiToken_
void SiStripShotFilter::updateCabling ( const edm::EventSetup eventSetup)
private

Definition at line 183 of file SiStripShotFilter.cc.

References cabling_, cablingCacheId_, edm::EventSetup::get(), and edm::ESHandle< class >::product().

Referenced by filter().

184 {
185  uint32_t currentCacheId = eventSetup.get<SiStripFedCablingRcd>().cacheIdentifier();
186  if (cablingCacheId_ != currentCacheId) {
187  edm::ESHandle<SiStripFedCabling> cablingHandle;
188  eventSetup.get<SiStripFedCablingRcd>().get(cablingHandle);
189  cabling_ = cablingHandle.product();
190  cablingCacheId_ = currentCacheId;
191  }
192 }
const SiStripFedCabling * cabling_
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86

Member Data Documentation

const SiStripFedCabling* SiStripShotFilter::cabling_
private

Definition at line 73 of file SiStripShotFilter.cc.

Referenced by filter(), and updateCabling().

uint32_t SiStripShotFilter::cablingCacheId_
private

Definition at line 72 of file SiStripShotFilter.cc.

Referenced by updateCabling().

edm::InputTag SiStripShotFilter::digicollection_
private

Definition at line 75 of file SiStripShotFilter.cc.

Referenced by SiStripShotFilter().

edm::EDGetTokenT<edm::DetSetVector<SiStripDigi> > SiStripShotFilter::digiToken_
private

Definition at line 76 of file SiStripShotFilter.cc.

Referenced by filter(), and SiStripShotFilter().

std::ofstream SiStripShotFilter::fOut_
private

Definition at line 69 of file SiStripShotFilter.cc.

Referenced by beginJob(), endJob(), and filter().

std::string SiStripShotFilter::fOutPath_
private

Definition at line 70 of file SiStripShotFilter.cc.

Referenced by beginJob().

bool SiStripShotFilter::zs_
private

Definition at line 77 of file SiStripShotFilter.cc.

Referenced by filter().