1 #ifndef Z_BIN_TEMPLATE_PROCESSOR_H
2 #define Z_BIN_TEMPLATE_PROCESSOR_H 1
8 #include "marlin/Processor.h"
16 #include <IMPL/LCCollectionVec.h>
17 #include <EVENT/Track.h>
18 #include <EVENT/TrackerHit.h>
22 #include <AIDA/AIDA.h>
23 #include <marlin/AIDAProcessor.h>
24 #include <AIDA/IHistogramFactory.h>
25 #include <AIDA/IHistogram1D.h>
26 #include <AIDA/IHistogram2D.h>
29 #include <marlin/Global.h>
75 template<
unsigned int N1DHISTOS,
unsigned int N2DHISTOS>
84 virtual Processor*
newProcessor() {
throw Exception(
"You cannot create an instance of ZBinTemplateProcessor"); }
98 streamlog_out(WARNING3) <<
"invalid _nZBins < 0 ; setting to 0"
106 streamlog_out(WARNING3) <<
"invalid z range, setting to 0"
119 for (
unsigned int i = 0 ; i < N1DHISTOS ; i++)
124 for (
unsigned int i = 0 ; i < N2DHISTOS ; i++)
132 for (
int zBin=0; zBin<=
_nZBins ; zBin++)
135 std::stringstream zRangeString;
136 std::stringstream zIndexString;
143 zIndexString << zBin ;
148 for (
unsigned int histoIndex = 0 ; histoIndex < N1DHISTOS ; histoIndex ++)
150 streamlog_out(DEBUG3) <<
"_1DHistos["<<histoIndex<<
"]["<<zBin<<
"]" << std::endl;
152 _1DHistos[histoIndex][zBin] = marlin::AIDAProcessor::histogramFactory(
this)->
160 for (
unsigned int histoIndex = 0 ; histoIndex < N2DHISTOS ; histoIndex ++)
163 _2DHistos[histoIndex][zBin] = marlin::AIDAProcessor::histogramFactory(
this)->
209 : marlin::Processor(typeName) , _isInitialised(false) {
211 _description =
"ZBinTemplateProcessor cannot be instantiated. Its a template class to derive from." ;
213 registerProcessorParameter(
"MaxZ" ,
214 "MaxZ Maximum z value of highest bin in case of z binning (default: 260)",
217 registerProcessorParameter(
"MinZ" ,
218 "MinZ Minimum z value of lowest bin in case of z binning (default: 0)",
221 registerProcessorParameter(
"nZBins" ,
222 "Number ob bins in z, 0 means one Histo without z cut (default: 10)",
247 for (
unsigned int i = 0 ; i < N1DHISTOS ; i++)
249 std::stringstream histoNameStream;
250 histoNameStream << typeName<<
"histo1D" << i <<
"_";
260 for (
unsigned int i = 0 ; i < N2DHISTOS ; i++)
262 std::stringstream histoNameStream;
263 histoNameStream << typeName<<
"histo2D" << i <<
"_";
288 throw Exception(
"ZBinTemplateProcessor is not initialised."
289 "Did you call ZBinTemplateProcessor::init() in your init function?");
299 if ( (zBin >= 0) && (zBin <
_nZBins) )
318 throw Exception(
"ZBinTemplateProcessor is not initialised."
319 "Did you call ZBinTemplateProcessor::init() in your init function?");
329 if ( (zBin >= 0) && (zBin <
_nZBins) )
340 std::vector< std::vector<AIDA::IHistogram1D *> >
_1DHistos;
341 std::vector< std::vector<AIDA::IHistogram2D *> >
_2DHistos;
376 #endif // Z_BIN_TEMLATE_PROCESSOR_H
void fillHistogram(unsigned int histoIndex, float x, float y, float z)
Fill the x and y value pair into the 2D histogram set histoIndex.
Definition: ZBinTemplateProcessor.h:315
std::vector< HistoRange2D > _histoRanges2D
Vector of ranges for the 2D histograms.
Definition: ZBinTemplateProcessor.h:359
int _nZBins
Number of z bins.
Definition: ZBinTemplateProcessor.h:366
A nested convenience struct which contains the number of bins for both directions of a 2D histogram...
Definition: ZBinTemplateProcessor.h:200
std::vector< HistoNBins2D > _nBins2D
Vector with number of bins for the 1D histograms.
Definition: ZBinTemplateProcessor.h:361
std::vector< std::string > _histo2DBaseNames
Vector of base names for the 2D histograms.
Definition: ZBinTemplateProcessor.h:349
std::vector< int > _nBins1D
Vector with number of bins for the 1D histograms.
Definition: ZBinTemplateProcessor.h:360
A template to create processors wich create 1D or 2D distribution histograms, one histogram per z bin...
Definition: ZBinTemplateProcessor.h:76
float _maxZ
Maximum z value of highest bin.
Definition: ZBinTemplateProcessor.h:364
virtual void init()
Register the AIDA histograms at the AIDAProcessor.
Definition: ZBinTemplateProcessor.h:89
std::vector< std::vector< AIDA::IHistogram1D * > > _1DHistos
Vector of 1D histogram vectors.
Definition: ZBinTemplateProcessor.h:340
float _minZ
Minimum z value of lowest bin.
Definition: ZBinTemplateProcessor.h:363
A nested convenience struct which contains the minimal and maximal value of a (1D) histogram rage...
Definition: ZBinTemplateProcessor.h:183
std::vector< std::vector< AIDA::IHistogram2D * > > _2DHistos
Vector of 2D histogram vectors.
Definition: ZBinTemplateProcessor.h:341
void fillHistogram(unsigned int histoIndex, float x, float z)
Fill value x into the histogram set histoIndex.
Definition: ZBinTemplateProcessor.h:286
std::vector< std::string > _histo1DBaseNames
Vector of base names for the 1D histograms.
Definition: ZBinTemplateProcessor.h:345
A nested convenience struct which contains two 1D HistoRange objects.
Definition: ZBinTemplateProcessor.h:192
std::vector< HistoRange > _histoRanges1D
Vector of ranges for the 1D histograms.
Definition: ZBinTemplateProcessor.h:358
std::vector< std::string > _histo2DTitles
Vector of titles for the 2D histograms.
Definition: ZBinTemplateProcessor.h:357
std::vector< std::string > _histo1DTitles
Vector of titles for the 1D histograms.
Definition: ZBinTemplateProcessor.h:353
virtual Processor * newProcessor()
The newProcessor() function does not make sense for this template class, so it throws an lcio::Except...
Definition: ZBinTemplateProcessor.h:84
float _zBinWidth
Width of a bin, calculated as (_maxZ-_minZ)/_nZBins;.
Definition: ZBinTemplateProcessor.h:368