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
APVShotsAnalyzer Class Reference

#include <DPGAnalysis/SiStripTools/plugins/APVShotsAnalyzer.cc>

Inheritance diagram for APVShotsAnalyzer:
edm::EDAnalyzer

Public Member Functions

 APVShotsAnalyzer (const edm::ParameterSet &)
 
 ~APVShotsAnalyzer ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
virtual void beginRun (const edm::Run &, const edm::EventSetup &)
 
virtual void endJob ()
 
virtual void endRun (const edm::Run &, const edm::EventSetup &)
 
void updateDetCabling (const edm::EventSetup &setup)
 

Private Attributes

uint32_t _cacheIdDet
 DB cache ID used to establish if the cabling has changed during the run. More...
 
const SiStripDetCabling_detCabling
 The cabling object. More...
 
edm::InputTag _digicollection
 
TH1F * _fed
 
TH1F * _median
 
TH2F * _medianVsFED
 
int _nevents
 
TH1F * _nShots
 
TH2F * _nShotsVsFED
 
TProfile * _nShotsVsTime
 
TH1F * _stripMult
 
TH1F * _subDetector
 
std::string _suffix
 
bool _useCabling
 
TH1F * _whichAPV
 
bool _zs
 
TkHistoMaptkhisto
 
TkHistoMaptkhisto2
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 66 of file APVShotsAnalyzer.cc.

Constructor & Destructor Documentation

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

Definition at line 120 of file APVShotsAnalyzer.cc.

References _fed, _median, _medianVsFED, _nShots, _nShotsVsFED, _nShotsVsTime, _stripMult, _subDetector, _suffix, _useCabling, _whichAPV, _zs, TFileDirectory::make(), tkhisto, and tkhisto2.

120  :
121  _digicollection(iConfig.getParameter<edm::InputTag>("digiCollection")),
122  _zs(iConfig.getUntrackedParameter<bool>("zeroSuppressed",true)),
123  _suffix(iConfig.getParameter<std::string>("mapSuffix")),
124  _nevents(0),
125  _useCabling(iConfig.getUntrackedParameter<bool>("useCabling",true)),
126  _cacheIdDet(0),
127  _detCabling(0)
128 {
129  //now do what ever initialization is needed
130 
131  if(!_zs) _suffix += "_notZS";
132 
134 
135  _nShots = tfserv->make<TH1F>("nShots","Number of Shots per event",200,-0.5,199.5);
136  _nShots->GetXaxis()->SetTitle("Shots"); _nShots->GetYaxis()->SetTitle("Events");
137  _nShots->StatOverflows(kTRUE);
138 
139  _nShotsVsTime = tfserv->make<TProfile>("nShotsVsTime","Mean number of shots vs orbit number",3600,0.5,3600*11223+0.5);
140  _nShotsVsTime->GetXaxis()->SetTitle("Orbit"); _nShotsVsTime->GetYaxis()->SetTitle("Number of Shots");
141  _nShotsVsTime->SetBit(TH1::kCanRebin);
142 
143  _whichAPV = tfserv->make<TH1F>("whichAPV","APV with shots",6,-0.5,5.5);
144  _whichAPV->GetXaxis()->SetTitle("APV"); _whichAPV->GetYaxis()->SetTitle("Shots");
145 
146  _stripMult = tfserv->make<TH1F>("stripMultiplicity","Shot Strip Multiplicity",129,-0.5,128.5);
147  _stripMult->GetXaxis()->SetTitle("Number of Strips"); _stripMult->GetYaxis()->SetTitle("Shots");
148 
149  _median = tfserv->make<TH1F>("median","APV Shot charge median",256,-0.5,255.5);
150  _median->GetXaxis()->SetTitle("Charge [ADC]"); _median->GetYaxis()->SetTitle("Shots");
151 
152  _subDetector = tfserv->make<TH1F>("subDets","SubDetector Shot distribution",10,-0.5,9.5);
153  _subDetector->GetYaxis()->SetTitle("Shots");
154 
155  if (_useCabling) {
156  _fed = tfserv->make<TH1F>("fed","FED Shot distribution",440,50,490);
157  _fed->GetYaxis()->SetTitle("Shots");
158 
159  _nShotsVsFED = tfserv->make<TH2F>("nShotsVsFED","Number of Shots per event vs fedid",440,50,490,200,-0.5,199.5);
160  _nShotsVsFED->GetXaxis()->SetTitle("fedId"); _nShots->GetYaxis()->SetTitle("Shots"); _nShots->GetZaxis()->SetTitle("Events");
161  _nShotsVsFED->StatOverflows(kTRUE);
162 
163  _medianVsFED = tfserv->make<TH2F>("medianVsFED","APV Shot charge median vs fedid",440,50,490,256,-0.5,255.5);
164  _medianVsFED->GetXaxis()->SetTitle("fedId");_medianVsFED->GetYaxis()->SetTitle("Charge [ADC]"); _median->GetZaxis()->SetTitle("Shots");
165  }
166 
167  tkhisto =new TkHistoMap("ShotMultiplicity","ShotMultiplicity",-1);
168  tkhisto2 =new TkHistoMap("StripMultiplicity","StripMultiplicity",-1);
169 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
TProfile * _nShotsVsTime
TkHistoMap * tkhisto2
const SiStripDetCabling * _detCabling
The cabling object.
TkHistoMap * tkhisto
T * make() const
make new ROOT object
uint32_t _cacheIdDet
DB cache ID used to establish if the cabling has changed during the run.
edm::InputTag _digicollection
APVShotsAnalyzer::~APVShotsAnalyzer ( )

Definition at line 172 of file APVShotsAnalyzer.cc.

References _detCabling.

173 {
174 
175  // do anything here that needs to be done at desctruction time
176  // (e.g. close files, deallocate resources etc.)
177  if ( _detCabling ) _detCabling = 0;
178 
179 }
const SiStripDetCabling * _detCabling
The cabling object.

Member Function Documentation

void APVShotsAnalyzer::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDAnalyzer.

Definition at line 188 of file APVShotsAnalyzer.cc.

References _detCabling, _digicollection, _fed, _median, _medianVsFED, _nevents, _nShots, _nShotsVsFED, _nShotsVsTime, _stripMult, _subDetector, _useCabling, _whichAPV, _zs, TkHistoMap::add(), gather_cfg::cout, sistrip::FED_ID_MAX, sistrip::FED_ID_MIN, TkHistoMap::fill(), edm::Event::getByLabel(), SiStripDetCabling::getConnections(), APVShotFinder::getShots(), edm::EventBase::orbitNumber(), tkhisto, tkhisto2, and updateDetCabling().

189 {
190  using namespace edm;
191 
192  if (_useCabling){
193  //retrieve cabling
194  updateDetCabling( iSetup );
195  }
196 
197  _nevents++;
198 
200  iEvent.getByLabel(_digicollection,digis);
201 
202  // loop on detector with digis
203 
204  int nshots=0;
205  std::vector<int> nshotsperFed;
206 
207  const uint16_t lNumFeds = sistrip::FED_ID_MAX-sistrip::FED_ID_MIN+1;
208  if (_useCabling){
209  nshotsperFed.resize(lNumFeds,0);
210  }
211 
212  APVShotFinder apvsf(*digis,_zs);
213  const std::vector<APVShot>& shots = apvsf.getShots();
214 
215  for(std::vector<APVShot>::const_iterator shot=shots.begin();shot!=shots.end();++shot) {
216  if(shot->isGenuine()) {
217 
218  //get the fedid from the detid
219 
220  uint32_t det=shot->detId();
221  if (_useCabling){
222  const std::vector<const FedChannelConnection *> & conns = _detCabling->getConnections( det );
223 
224  if (!(conns.size())) continue;
225  uint16_t lFedId = 0;
226  for (uint32_t ch = 0; ch<conns.size(); ch++) {
227  lFedId = conns[ch]->fedId();
228  //uint16_t lFedCh = conns[ch]->fedCh();
229 
230  if (lFedId < sistrip::FED_ID_MIN || lFedId > sistrip::FED_ID_MAX){
231  std::cout << " -- Invalid fedid " << lFedId << " for detid " << det << " connection " << ch << std::endl;
232  continue;
233  }
234  else break;
235  }
236 
237  if (lFedId < sistrip::FED_ID_MIN || lFedId > sistrip::FED_ID_MAX){
238  std::cout << " -- No valid fedid (=" << lFedId << ") found for detid " << det << std::endl;
239  continue;
240  }
241  ++nshotsperFed[lFedId-sistrip::FED_ID_MIN];
242  _fed->Fill(lFedId);
243  _medianVsFED->Fill(lFedId,shot->median());
244 
245 
246  }
247 
248  ++nshots;
249 
250 
251  _whichAPV->Fill(shot->apvNumber());
252  _median->Fill(shot->median());
253  _stripMult->Fill(shot->nStrips());
254  _subDetector->Fill(shot->subDet());
255  tkhisto2->fill(det,shot->nStrips());;
256  tkhisto->add(det,1);
257 
258 
259 
260  }
261  }
262 
263  _nShots->Fill(nshots);
264  if (_useCabling){
265  for (uint16_t lFed(0); lFed<lNumFeds; lFed++){
266  _nShotsVsFED->Fill(lFed+sistrip::FED_ID_MIN,nshotsperFed[lFed]);
267  }
268  }
269 
270  _nShotsVsTime->Fill(iEvent.orbitNumber(),nshots);
271 
272 
273 }
static const uint16_t FED_ID_MIN
TProfile * _nShotsVsTime
const std::vector< const FedChannelConnection * > & getConnections(uint32_t det_id) const
TkHistoMap * tkhisto2
void fill(uint32_t &detid, float value)
Definition: TkHistoMap.cc:130
const SiStripDetCabling * _detCabling
The cabling object.
int orbitNumber() const
Definition: EventBase.h:63
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
TkHistoMap * tkhisto
tuple cout
Definition: gather_cfg.py:121
static const uint16_t FED_ID_MAX
void add(uint32_t &detid, float value)
Definition: TkHistoMap.cc:163
void updateDetCabling(const edm::EventSetup &setup)
edm::InputTag _digicollection
void APVShotsAnalyzer::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 287 of file APVShotsAnalyzer.cc.

288 {
289 
290 }
void APVShotsAnalyzer::beginRun ( const edm::Run iRun,
const edm::EventSetup  
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 276 of file APVShotsAnalyzer.cc.

277 {}
virtual void APVShotsAnalyzer::endJob ( )
privatevirtual

Reimplemented from edm::EDAnalyzer.

void APVShotsAnalyzer::endRun ( const edm::Run iRun,
const edm::EventSetup  
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 280 of file APVShotsAnalyzer.cc.

281 {
282 }
void APVShotsAnalyzer::updateDetCabling ( const edm::EventSetup setup)
private

Definition at line 316 of file APVShotsAnalyzer.cc.

References _cacheIdDet, _detCabling, _useCabling, trackerHits::c, edm::EventSetup::get(), and edm::ESHandle< class >::product().

Referenced by analyze().

317 {
318  if (_useCabling){
319  uint32_t cache_id = setup.get<SiStripDetCablingRcd>().cacheIdentifier();//.get( cabling_ );
320 
321  if ( _cacheIdDet != cache_id ) { // If the cache ID has changed since the last update...
322  // Update the cabling object
324  setup.get<SiStripDetCablingRcd>().get( c );
325  _detCabling = c.product();
326  _cacheIdDet = cache_id;
327  } // end of new cache ID check
328  }
329 }
const SiStripDetCabling * _detCabling
The cabling object.
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
uint32_t _cacheIdDet
DB cache ID used to establish if the cabling has changed during the run.

Member Data Documentation

uint32_t APVShotsAnalyzer::_cacheIdDet
private

DB cache ID used to establish if the cabling has changed during the run.

Definition at line 104 of file APVShotsAnalyzer.cc.

Referenced by updateDetCabling().

const SiStripDetCabling* APVShotsAnalyzer::_detCabling
private

The cabling object.

Definition at line 105 of file APVShotsAnalyzer.cc.

Referenced by analyze(), updateDetCabling(), and ~APVShotsAnalyzer().

edm::InputTag APVShotsAnalyzer::_digicollection
private

Definition at line 83 of file APVShotsAnalyzer.cc.

Referenced by analyze().

TH1F* APVShotsAnalyzer::_fed
private

Definition at line 94 of file APVShotsAnalyzer.cc.

Referenced by analyze(), and APVShotsAnalyzer().

TH1F* APVShotsAnalyzer::_median
private

Definition at line 92 of file APVShotsAnalyzer.cc.

Referenced by analyze(), and APVShotsAnalyzer().

TH2F* APVShotsAnalyzer::_medianVsFED
private

Definition at line 96 of file APVShotsAnalyzer.cc.

Referenced by analyze(), and APVShotsAnalyzer().

int APVShotsAnalyzer::_nevents
private

Definition at line 86 of file APVShotsAnalyzer.cc.

Referenced by analyze().

TH1F* APVShotsAnalyzer::_nShots
private

Definition at line 88 of file APVShotsAnalyzer.cc.

Referenced by analyze(), and APVShotsAnalyzer().

TH2F* APVShotsAnalyzer::_nShotsVsFED
private

Definition at line 97 of file APVShotsAnalyzer.cc.

Referenced by analyze(), and APVShotsAnalyzer().

TProfile* APVShotsAnalyzer::_nShotsVsTime
private

Definition at line 89 of file APVShotsAnalyzer.cc.

Referenced by analyze(), and APVShotsAnalyzer().

TH1F* APVShotsAnalyzer::_stripMult
private

Definition at line 91 of file APVShotsAnalyzer.cc.

Referenced by analyze(), and APVShotsAnalyzer().

TH1F* APVShotsAnalyzer::_subDetector
private

Definition at line 93 of file APVShotsAnalyzer.cc.

Referenced by analyze(), and APVShotsAnalyzer().

std::string APVShotsAnalyzer::_suffix
private

Definition at line 85 of file APVShotsAnalyzer.cc.

Referenced by APVShotsAnalyzer().

bool APVShotsAnalyzer::_useCabling
private

Definition at line 103 of file APVShotsAnalyzer.cc.

Referenced by analyze(), APVShotsAnalyzer(), and updateDetCabling().

TH1F* APVShotsAnalyzer::_whichAPV
private

Definition at line 90 of file APVShotsAnalyzer.cc.

Referenced by analyze(), and APVShotsAnalyzer().

bool APVShotsAnalyzer::_zs
private

Definition at line 84 of file APVShotsAnalyzer.cc.

Referenced by analyze(), and APVShotsAnalyzer().

TkHistoMap* APVShotsAnalyzer::tkhisto
private

Definition at line 100 of file APVShotsAnalyzer.cc.

Referenced by analyze(), and APVShotsAnalyzer().

TkHistoMap * APVShotsAnalyzer::tkhisto2
private

Definition at line 100 of file APVShotsAnalyzer.cc.

Referenced by analyze(), and APVShotsAnalyzer().