7#define ANSI_COLOR_RED "\x1b[91m"
8#define ANSI_COLOR_BLUE "\x1b[94m"
9#define ANSI_COLOR_RESET "\x1b[0m"
13#include "BmnFieldConst.h"
14#include "BmnFieldMap.h"
15#include "BmnTrigDigit.h"
17#include "FairBaseParSet.h"
18#include "FairGeoParSet.h"
19#include "FairLogger.h"
20#include "FairRunAna.h"
21#include "FairRuntimeDb.h"
27#include "function_set.h"
64 LOG(debug) <<
"Defaul Constructor of BmnFillDstTask";
96 LOG(debug) <<
"Constructor of BmnFillDstTask";
130 LOG(debug) <<
"Constructor of BmnFillDstTask";
140 LOG(debug) <<
"Destructor of BmnFillDstTask";
150 FairRootManager* ioman = FairRootManager::Instance();
154 TObject* pObj = ioman->GetObject(
"BmnEventHeader.");
175 LOG(debug) <<
"Initialization of BmnFillDstTask";
180 FairRootManager* ioman = FairRootManager::Instance();
182 LOG(error) <<
"Init: FairRootManager is not instantiated! BmnFillDstTask task will be deactivated";
189 LOG(error) <<
"No input Event Header (BmnEventHeader. or MCEventHeader.) found! BmnFillDstTask task will "
213 LOG(error) <<
"No DstEventHeader prepared for the output DST file! BmnFillDstTask task will be deactivated";
221 FairField* fField = FairRunAna::Instance()->GetField();
222 if (fField !=
nullptr) {
224 if (fField->GetType() == 0) {
228 "%f:%f:%f:%f:%f:%f:%f:%f:%f", fFieldConst->
GetXmin(), fFieldConst->
GetXmax(), fFieldConst->
GetYmin(),
234 fRunHeader->SetFieldName(fFieldMap->GetName());
243 FairGeoParSet* geopar =
dynamic_cast<FairGeoParSet*
>(FairRuntimeDb::instance()->getContainer(
"FairGeoParSet"));
246 geopar->setChanged();
251 if (pCurrentRun != 0) {
258 if (end_date != NULL) {
270 map<TString, stParticleInfo>::iterator it =
mapParticleInfo.find(beam);
275 LOG(warn) <<
"BmnFillDstTask::Init(): unknown beam '" << beam
276 <<
"', A and Z are not written to the run header";
277 double* energy = pCurrentRun->
GetEnergy();
278 if (energy != NULL) {
289 if (comment_pos !=
kNPOS)
290 target.
Remove(comment_pos);
297 LOG(warn) <<
"BmnFillDstTask::Init(): unknown target '" << target
298 <<
"', A and Z are not written to the run header";
312 FairBaseParSet* pBasePar =
313 dynamic_cast<FairBaseParSet*
>(FairRuntimeDb::instance()->getContainer(
"FairBaseParSet"));
315 fRunHeader->SetBeamEnergy(pBasePar->GetBeamMom());
317 TString beam =
"", target =
"";
329 map<TString, stParticleInfo>::iterator it =
mapParticleInfo.find(beam);
334 LOG(warn) <<
"BmnFillDstTask::Init(): unknown beam '" << beam
335 <<
"', A and Z are not written to the run header";
343 LOG(warn) <<
"BmnFillDstTask::Init(): unknown target '" << target
344 <<
"', A and Z are not written to the run header";
351 LOG(debug) <<
"BmnFillDstTask::Init(): branch PrimaryVertex not found! The task is deactivated" << endl;
357 LOG(debug) <<
"BmnFfBC1illDstTask::Init(): branch BmnGlobalTrack not found! The task is deactivated" << endl;
366 LOG(debug) <<
"BmnFillDstTask::Init(): branch MCTrack not found" << endl;
379 LOG(debug) <<
"Re-initilization of BmnFillDstTask";
398 LOG(debug) <<
"Exec of BmnFillDstTask";
426 Double_t Z2in = -100.0, Z2out = -100.0;
427 Double_t adcIn = -100.0, adcOut = -100.0;
433 for (
Int_t i = 0;
i <
fT0->GetEntriesFast();
i++) {
443 if (Z2out != -1000) {
446 Z2out = Z2out * Z2out;
458 for (
Int_t i = 0;
i <
fT0->GetEntriesFast();
i++) {
475 Double_t Z1 = -100.0, Z2 = -100.0, Z3 = -100.0, Z4 = -100.0, ADC1 = -100.0, ADC2 = -100.0, ADC3 = -100.0,
481 for (
Int_t i = 0;
i <
fT0->GetEntriesFast();
i++) {
483 if (digT0->
GetMod() == 0) {
510 if (fVerbose == -9999) {
511 if (
gROOT->IsBatch()) {
528 Int_t pos = barWidth * progress;
529 for (
Int_t i = 0;
i < barWidth; ++
i) {
547 LOG(info) << strVertex.
Data();
550 LOG(info) <<
"\tglobal tracks = " <<
fGlobalTracks->GetEntries();
564 LOG(debug) <<
"Finish of BmnFillDstTask";
566 FairRootManager* ioman = FairRootManager::Instance();
570 printf(
"Work time of BmnFillDstTask: %4.2f sec.\n",
workTime);
576 LOG(debug) <<
"SetParContainers of BmnFillDstTask";
594 TString gPathFullBC = gPathWorkdir +
"/input/BC12Corrections.txt";
595 ifstream fin(gPathFullBC.
Data());
598 while (runBC !=
fRunNumber && safeindex != 20000) {
602 safeindex = safeindex + 1;
605 if (safeindex == 20000)
606 cout <<
"run number not found in file " << gPathFullBC << endl;
608 TString gPathFull = gPathWorkdir +
"/input/ZOutCorrections5.txt";
611 ifstream f(gPathFull.
Data(), ios::in);
612 vector<Double_t> axisAttr;
619 TString str_run(currString(0, 4));
620 run = str_run.
Atoi();
624 cout << currString.
Data() << endl;
644 mapParticleInfo.insert(pair<TString, stParticleInfo>(
"d", particle_info));
645 particle_info.
A = 12;
647 mapParticleInfo.insert(pair<TString, stParticleInfo>(
"c", particle_info));
648 particle_info.
A = 40;
649 particle_info.
Z = 18;
650 mapParticleInfo.insert(pair<TString, stParticleInfo>(
"ar", particle_info));
651 particle_info.
A = 84;
652 particle_info.
Z = 36;
653 mapParticleInfo.insert(pair<TString, stParticleInfo>(
"kr", particle_info));
654 particle_info.
A = 124;
655 particle_info.
Z = 54;
656 mapParticleInfo.insert(pair<TString, stParticleInfo>(
"xe", particle_info));
657 particle_info.
A = 73;
658 particle_info.
Z = 32;
659 mapParticleInfo.insert(pair<TString, stParticleInfo>(
"ge", particle_info));
660 particle_info.
A = 27;
661 particle_info.
Z = 13;
662 mapParticleInfo.insert(pair<TString, stParticleInfo>(
"al", particle_info));
663 particle_info.
A = 207;
664 particle_info.
Z = 82;
665 mapParticleInfo.insert(pair<TString, stParticleInfo>(
"pb", particle_info));
667 mapParticleInfo.insert(pair<TString, stParticleInfo>(
"src lead 1", particle_info));
668 mapParticleInfo.insert(pair<TString, stParticleInfo>(
"src lead 2", particle_info));
669 mapParticleInfo.insert(pair<TString, stParticleInfo>(
"src lead 3", particle_info));
670 particle_info.
A = 119;
671 particle_info.
Z = 50;
672 mapParticleInfo.insert(pair<TString, stParticleInfo>(
"sn", particle_info));
673 particle_info.
A = 64;
674 particle_info.
Z = 29;
675 mapParticleInfo.insert(pair<TString, stParticleInfo>(
"cu", particle_info));
678 mapParticleInfo.insert(pair<TString, stParticleInfo>(
"h2", particle_info));
680 particle_info.
A = 29;
682 mapParticleInfo.insert(pair<TString, stParticleInfo>(
"c2h4", particle_info));
683 particle_info.
A = 260;
685 mapParticleInfo.insert(pair<TString, stParticleInfo>(
"csi", particle_info));
689 mapParticleInfo.insert(pair<TString, stParticleInfo>(
"empty", particle_info));
R__EXTERN TGeoManager * gGeoManager
R__EXTERN TSystem * gSystem
virtual Double_t GetBz(Double_t x, Double_t y, Double_t z)
Double_t GetXmin() const
Accessors to field region.
virtual Double_t GetBy(Double_t x, Double_t y, Double_t z)
virtual Double_t GetBx(Double_t x, Double_t y, Double_t z)
Get components of field at a given point.
Double_t GetScale() const
Accessor to global scaling factor.
virtual void SetParContainers()
Load the parameter container from the runtime database.
virtual void Finish()
Finish task called at the end.
DstRunHeader * fRunHeader
Output BmnRunHeader.
void InitParticleInfo()
Fill map with weight-charge of possible particles.
Int_t fRunNumber
run number
Long64_t fNStartEvent
start event from which the processing is started
void Reset()
Reset variables between events.
TClonesArray * fMCTracks
Input Monte-Carlo tracks from Simulation File.
Long64_t fNEvents
event count to be processed
BmnEventHeader * fEventHeader
Input BmnEventHeader from Experimental Digit File.
virtual InitStatus Init()
Initialization of task at the beginning.
FairMCEventHeader * fMCEventHeader
Input MCEventHeader from Simulation File.
DstEventHeader * fDstHeader
Output DstEventHeader prepared in FairRunAna.
CbmVertex * fPrimaryVertex
pointer to primary vertex in the current event
bool autoSetHeaders()
set headers with autodefinition whether experimental or simulation data are used
virtual void Exec(Option_t *opt)
Executed for each event.
Long64_t fIEvent
current event being processed for progress bar
Int_t fPeriodNumber
period number
TClonesArray * fGlobalTracks
pointer to global tracks in the current event
Double_t fZCalib1
z calibration parameters:
BmnFillDstTask()
Default constructor.
BmnMCInfoDst * fMCInfoDst
Output MC Information for physics analysis.
map< TString, stParticleInfo > mapParticleInfo
map with particle names and corresponding weight-charge pairs
virtual InitStatus ReInit()
ReInitialization of task when the runID/file changes.
~BmnFillDstTask()
Destructor.
BmnTask()
Default constructor.
Int_t GetEntriesFast() const
TObject * At(Int_t idx) const override
virtual Bool_t InheritsFrom(const char *classname) const
void Start(Bool_t reset=kTRUE)
TSubString Strip(EStripType s=kTrailing, char c=' ') const
Ssiz_t First(char c) const
const char * Data() const
TObjArray * Tokenize(const TString &delim) const
static TString Format(const char *fmt,...)
TString & Remove(EStripType s, char c)
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
UniRun.h Class for the table: run_.
double * GetEnergy()
get energy of the current run
static UniRun * GetRun(int period_number, int run_number)
get run from the database
TDatime * GetEndDatetime()
get end datetime of the current run
TString GetBeamParticle()
get beam particle of the current run
TDatime GetStartDatetime()
get start datetime of the current run
TString GetTargetParticle()
get target particle of the current run
RVec< PromoteType< T > > sqrt(const RVec< T > &v)
struct timespec convert_double_to_timespec(double sec)