CbmRoot
Loading...
Searching...
No Matches
CbmMcbm2020TrdTshiftPar.h
Go to the documentation of this file.
1/* Copyright (C) 2021 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Pascal Raisig [committer] */
4
5#ifndef CbmMcbm2020TrdTshiftPar_H
6#define CbmMcbm2020TrdTshiftPar_H
7
8#include "FairParGenericSet.h" // mother class
9
10// STD
11#include <map>
12
13// ROOT
14#include <TArrayD.h>
15#include <TArrayI.h>
16#include <TFile.h>
17#include <TH2.h>
18#include <TH3.h>
19
20class CbmMcbm2020TrdTshiftPar : public FairParGenericSet {
21public:
22 CbmMcbm2020TrdTshiftPar(const char* name = "CbmMcbm2020TrdTshiftPar",
23 const char* title = "TRD timeshift unpacker parameters mCbm 2020",
24 const char* context = "Default");
25
27
28 virtual void printparams();
29
31 virtual void clear();
32
33 void putParams(FairParamList*);
34 Bool_t getParams(FairParamList*);
35
36 bool GetTimeshifts(std::shared_ptr<TH2> timeshiftHisto);
38
39 double GetNEvents(std::shared_ptr<TFile> mcbmanafile);
41
42
43 std::vector<Int_t> GetTimeshiftsVec(size_t tsidx);
45
46 std::map<size_t, std::vector<Int_t>>* GetTimeshiftsMap() { return &fmapTimeshifts; }
48
49
50 std::shared_ptr<TH3> GetCalibHisto(std::shared_ptr<TFile> mcbmanafile);
52
53 std::shared_ptr<TH2> GetCalibHisto(std::shared_ptr<TH3> calibbasehisto);
55
56 Int_t GetDominantShift(std::shared_ptr<TH3> calibbasehisto, size_t itsidx, size_t ichannel);
58
59 bool FillTimeshiftArray(std::shared_ptr<TFile> mcbmanafile);
61
62private:
63 const std::vector<std::string> pararraynames = {"nTimeslices", "TrdTimeshifts"};
65
66 const size_t fgNchannels = 768;
68 // In principle this could be retrieved from the standard parameters. But since we hopefully need these ugly parameters only for mCbm2020 it is hardcoded, because a handling via the parameters would require full linking of the standard Trd parameter classes
69
70 const UInt_t fgMicroSliceLength = 1.280e6;
72
73 TArrayI fTimeshifts = {};
75
76 TArrayI fNtimeslices;
78
79 std::map<size_t, std::vector<Int_t>> fmapTimeshifts = {};
81
82 std::vector<Int_t> fvecCurrentTimeshifts = {};
84
85public:
87};
88
89#endif // CbmMcbm2020TrdTshiftPar_H
std::map< size_t, std::vector< Int_t > > fmapTimeshifts
std::vector< Int_t > GetTimeshiftsVec(size_t tsidx)
Return the timeshift vector for a given Timeslice Index. Works only if getParams() was run before.
bool FillTimeshiftArray(std::shared_ptr< TFile > mcbmanafile)
Extract the timeshift values from a TAF output file that contains the required histograms and write t...
const std::vector< std::string > pararraynames
Names of the parameter arrays.
std::vector< Int_t > fvecCurrentTimeshifts
< Keys of the map are the tsIdx when a shift value for any channel changes, the vector contains the s...
std::shared_ptr< TH3 > GetCalibHisto(std::shared_ptr< TFile > mcbmanafile)
Extract the required base histogram from a mcbmana task output file.
TArrayI fTimeshifts
Array contains the timeshifts. Everytime a timeshift appears the tsIdx from the TS MetaData is follow...
Int_t GetDominantShift(std::shared_ptr< TH3 > calibbasehisto, size_t itsidx, size_t ichannel)
Extract the dominant shift value from the calibbase histogram. For a give tsIdx and channel.
double GetNEvents(std::shared_ptr< TFile > mcbmanafile)
Extract the number of events from a mcbmana task output file, which has to contain the required histo...
Bool_t getParams(FairParamList *)
const size_t fgNchannels
Number of channels on the single Trd module used during mCbm2020.
bool GetTimeshifts(std::shared_ptr< TH2 > timeshiftHisto)
Extract the timeshift values from a histo containing the information and write them to fTimeshifts.
TArrayI fNtimeslices
Number of timeslices in the given run. This is required to fill a complete fmapTimeshifts,...
const UInt_t fgMicroSliceLength
Length of a single microslice during mCbm 2020 data taking.
std::map< size_t, std::vector< Int_t > > * GetTimeshiftsMap()
Return the timeshift map.
ClassDef(CbmMcbm2020TrdTshiftPar, 2)
< Vector containing the "current" timeshift values for all Trd channles of the mCbm2020 module
CbmMcbm2020TrdTshiftPar(const char *name="CbmMcbm2020TrdTshiftPar", const char *title="TRD timeshift unpacker parameters mCbm 2020", const char *context="Default")