MarlinTPC  1.2.0
Classes | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
marlintpc::PedestalCalculator Class Reference

Calculates the pedestals out of raw data. More...

#include <PedestalCalculator.h>

Inheritance diagram for marlintpc::PedestalCalculator:

Classes

struct  ChannelPedestal
 Structure to store the pedestal of a channel and other needed informations during internal calculations. More...
 
struct  StcPedestal
 Structure to store pedestal value and width. More...
 

Public Member Functions

virtual Processor * newProcessor ()
 
virtual void init ()
 Called at the begin of the job before anything is read. More...
 
virtual void processRunHeader (lcio::LCRunHeader *run)
 Called for every run.
 
virtual void processEvent (lcio::LCEvent *evt)
 Called for every event - the working horse. More...
 
virtual void check (lcio::LCEvent *evt)
 
virtual void end ()
 Called after data processing for clean up.
 

Protected Types

typedef std::vector
< StcPedestal * > 
PedestalVector_t
 Typedef: vector to store pedestal data. More...
 
typedef std::map< std::pair
< int, int >, ChannelPedestal * > 
PedestalMap_t
 Typedef: Map to store the pedestal data during calculation. More...
 

Protected Member Functions

StcPedestalcalcPedestal (FloatVec *Data)
 Claculates the pedestal mean and width from raw data. More...
 
virtual void calcAverage (ChannelPedestal *thisChannelPedestal)
 Calculates average of pedestals of different events of a channel. More...
 
virtual void CreatePedestalCollection (PedestalMap_t *thisChannelPedestalCollection)
 Creates an LCCollectionVector of Pedestals and fills it with the calculated pedestals.
 
virtual void printPedestal (PedestalMap_t *thisChannelPedestalCollection)
 Write the pedestal to the std output.
 
virtual void printPedestalShort (PedestalMap_t *thisChannelPedestalCollection)
 Writes a summery of the pedestals to the std output.
 
virtual void printPedestal (LCCollection *thisCollection)
 
virtual void makeLCCDData ()
 Converts the pedestal information to Pedestal objects and stores them into an LCCollection Vector.
 

Protected Attributes

PedestalMap_t_PedestalMap
 Map to store the pedestals internally during the calculation.
 
std::pair< int, int > _ChannelPair
 Channel identifier, pair of two integers (first one for the pad and second one for the readout group)
 
std::string _inputColName
 Name of the input collection.
 
std::string _pedestalColName
 Name of the pedestal collection.
 
std::string _simpleFileName
 Name of the simple file where the pedestal collection should be stored (optional)
 
std::string _dbFolder
 Name of the folder, where the pedestal collection should be stored in the database (optional)
 
std::string _dbInitString
 DBInit String (optional, can also be provided by evironment varibale)
 
std::string _conditionsTag
 Tag of the conditions data that should be stored.
 
int _writeEveryNEvents
 Calculate and write the calculated pedestals after this number of events.
 
std::string _validFrom
 Time from when the calculated pedestals will be valid (is stored in the database).
 
std::string _validTill
 Time till when the calculated pedestals will be valid (is stored in the database).
 
int _calculationIterations
 How many times the calculation iterates over the raw data vector.
 
int _ignoreSurrounding
 

time slices before and after the currend slice must not be a signal.


 
float _initCalcWidth
 Start value for the pedestal width for the calculation.
 
double _precision
 Precision of pedestal calculation.
 
double _signalThreshold
 Data time slice is considered a signal during calculation iteration, if is bigger than signalThreshold * pedestal width.
 
bool _makeRunNumberFolder
 parameter if sub-folder named by run number should be automatically added to the database folder
 
int _NRun
 
int _NEvt
 
lcio::long64 _validFromInt
 
lcio::long64 _validTillInt
 
lcio::long64 _lastSinceTime
 
lcio::long64 _lastEventTime
 

Detailed Description

Calculates the pedestals out of raw data.

This processor calculates the channel pedestals out of measurement raw data. The signals are filtered out and the pedestal values and widths are calculated from the remaining ADC spectrum. Usually, one thousand events are enough to make a decent calculation. The processor writes the pedestal in every case at the end of the input and always when a new run header comes. In addition the parameter WriteEveryNEvents can be set so that after a certain amount of events a new collection will be written. After the calculation the Pedestal objects are stored in a LCCollectionVector and stored as LCCD data.

Parameters
InputColNameName ofName for the input colletion the input colletion (string, default="TPCConvertedRawData")
PedestalCollectionNameName of the collection containing the pedestals. (string, default: "TPCPedestal")
SimpleFileNameName of the simple LCIO file the pedestals should be written to (without: .slcio !). If this is set, the processor will write the *pedestal calculation results to a simple LCIO file in a collection. The name given here will be expanded by the run numbers (as given in the run header) and if WriteEveryNEvents is set in addition by a 3 digit counting variable. Also the file name extension ".slcio" will be automatically added (optional, string)
DBFolderFolder in the database where the pedestals will be written to. This is an optional parameter. if it is set, the skript will try to write the results to a database. If not and the simple file option is not chossen, the data will not be written after the calculation. (optional string, default "test/pedestals")
DBInitStringInit spring for the connection to the database. This parameter is optional. If you do not set it, the environment variable $LCCD_DB_INIT should be set to the database details, since in this case this processor tries to get the parameters then from there. The string (either as parameter or as environment variable) should have the form "DB_HOST:DB_NAME:DB_USER:PASSWD". (string, optional, no default)
ConditionsTagThis parameter sets the tag of the conditions data you are writing. If not set, no tagging will be performed (optional, string, default: "1.0")
WriteEveryNEventsThis parameter gives the option to write the calculated pedestals every N events, if set to -1 the pedestals will be calculated and written after all events in the input file(s) have been read. (integer, default: -1)
ValidFromThis optional parameter sets the time the conditions data will be valid from in the conditions database. If not set, the time of the first event will be taken at the validuity start time. (lcio::long64)
ValidTillThis optional parameter sets the time the conditions data will be valid till in the conditions database. If not set, the time of the last event will be taken at the validuity end time. (lcio::long64)
CalculationIterationsHow many times the calculation iterates over the raw data vector. (integer, default: 5)
IgnoreSurrounding# time slices before and after the currend slice must not be a signal. (integer, default: 5)
InitCalcWidthStart value for the pedestal width for the calculation. (float, default: 512.0)
PrecisionPrecision of pedestal calculation. (double, default: 1.0E-5)
SignalThresholdData time slice is considered a signal during calculation iteration, if is bigger than signalThreshold * pedestal width. (double, default: 5.0)
MakeRunNumberFolderIf true, a sub-folder named like the run number will be created in the database folder DBFolder. The pedestals are then stored in this folder for this run (bool, default: false)
Author
M. E. Janssen (DESY), R. Diener (DESY)

Member Typedef Documentation

typedef std::map< std::pair<int, int>, ChannelPedestal* > marlintpc::PedestalCalculator::PedestalMap_t
protected

Typedef: Map to store the pedestal data during calculation.

Typedef of a map of ChannelPedestals to store the pedestal data during the calculation. The key is a pair of integers, first entry: channel ID, second: readout group. The ChannelPedestal struct contains: channel and readout group ID, a data vector (for ADC counts), a PedestalVector_t and tow structs for the average of the pedestal value and width and the error of the average values

Typedef: vector to store pedestal data.

Typedef to store the pedestal (the StcPedestal struct contains the mean and the width of the pedestal) in a vector

Member Function Documentation

void marlintpc::PedestalCalculator::calcAverage ( ChannelPedestal thisChannelPedestal)
protectedvirtual

Calculates average of pedestals of different events of a channel.

Calculates the average of the values for mean and width of the pedestal of the given structure and save it in this structure.

References marlintpc::PedestalCalculator::ChannelPedestal::Average, marlintpc::PedestalCalculator::ChannelPedestal::AverageError, marlintpc::PedestalCalculator::StcPedestal::Mean, marlintpc::PedestalCalculator::ChannelPedestal::PedestalCol, and marlintpc::PedestalCalculator::StcPedestal::Width.

PedestalCalculator::StcPedestal * marlintpc::PedestalCalculator::calcPedestal ( FloatVec *  Data)
protected

Claculates the pedestal mean and width from raw data.

Calculate the mean and the width of the pedestal out of the given raw data vector.

Returns
A structure Pedestal containing these values (channel and readout group ID, a data vector [ADC counts], a PedestalVector_t and tow structs for the average of the pedestal value and width and the error of the avergae values).

References marlintpc::PedestalCalculator::StcPedestal::Mean, and marlintpc::PedestalCalculator::StcPedestal::Width.

void marlintpc::PedestalCalculator::init ( )
virtual

Called at the begin of the job before anything is read.

Use to initialize the processor, e.g. book histograms.

void marlintpc::PedestalCalculator::processEvent ( lcio::LCEvent *  evt)
virtual

Called for every event - the working horse.

std::cout<<"clear data"<<std::endl;


The documentation for this class was generated from the following files: