173 LOG(debug) <<
"Initialization of BmnFillDstTask";
178 FairRootManager* ioman = FairRootManager::Instance();
180 LOG(error) <<
"Init: FairRootManager is not instantiated! BmnFillDstTask task will be deactivated";
185 if (isExpData == -1) {
186 if (!autoSetHeaders()) {
187 LOG(error) <<
"No input Event Header (BmnEventHeader. or MCEventHeader.) found! BmnFillDstTask task will "
193 fMCEventHeader = (FairMCEventHeader*)ioman->GetObject(
"MCEventHeader.");
195 fEventHeader = (
BmnEventHeader*)ioman->GetObject(
"BmnEventHeader.");
201 if (isExpData == 1) {
202 fT0 = (TClonesArray*)ioman->GetObject(
"BC2");
203 fBC1 = (TClonesArray*)ioman->GetObject(
"TQDC_BC1");
204 fBC2 = (TClonesArray*)ioman->GetObject(
"TQDC_BC2");
205 fBC3 = (TClonesArray*)ioman->GetObject(
"TQDC_BC3");
206 fBC4 = (TClonesArray*)ioman->GetObject(
"TQDC_BC4");
209 fDstHeader = (
DstEventHeader*)ioman->GetObject(
"DstEventHeader.");
211 LOG(error) <<
"No DstEventHeader prepared for the output DST file! BmnFillDstTask task will be deactivated";
215 if (ioman->CheckMaxEventNo(fNEvents) < fNEvents)
216 fNEvents = ioman->CheckMaxEventNo(fNEvents);
219 FairField* fField = FairRunAna::Instance()->GetField();
220 if (fField !=
nullptr) {
222 if (fField->GetType() == 0) {
226 "%f:%f:%f:%f:%f:%f:%f:%f:%f", fFieldConst->
GetXmin(), fFieldConst->
GetXmax(), fFieldConst->
GetYmin(),
237 if (fRunNumber > 0) {
241 FairGeoParSet* geopar =
dynamic_cast<FairGeoParSet*
>(FairRuntimeDb::instance()->getContainer(
"FairGeoParSet"));
243 geopar->SetGeometry(gGeoManager);
244 geopar->setChanged();
249 if (pCurrentRun != 0) {
252 TTimeStamp tsStartTime(start_date.GetYear(), start_date.GetMonth(), start_date.GetDay(),
253 start_date.GetHour(), start_date.GetMinute(), start_date.GetSecond());
256 if (end_date != NULL) {
260 TTimeStamp tsEndTime(end_date->GetYear(), end_date->GetMonth(), end_date->GetDay(), end_date->GetHour(),
261 end_date->GetMinute(), end_date->GetSecond());
267 map<TString, stParticleInfo>::iterator it = mapParticleInfo.find(beam);
268 if (it != mapParticleInfo.end()) {
272 double* energy = pCurrentRun->
GetEnergy();
273 if (energy != NULL) {
281 it = mapParticleInfo.find(target);
282 if (it != mapParticleInfo.end()) {
291 if (fPeriodNumber > 0)
296 fPrimaryVertex = (
CbmVertex*)ioman->GetObject(
"PrimaryVertex.");
297 if (!fPrimaryVertex) {
298 LOG(debug) <<
"BmnFillDstTask::Init(): branch PrimaryVertex not found! The task is deactivated" << endl;
302 fGlobalTracks = (TClonesArray*)ioman->GetObject(
"BmnGlobalTrack");
303 if (!fGlobalTracks) {
304 LOG(debug) <<
"BmnFfBC1illDstTask::Init(): branch BmnGlobalTrack not found! The task is deactivated" << endl;
310 if (isExpData == 0) {
311 fMCTracks = (TClonesArray*)ioman->GetObject(
"MCTrack");
313 LOG(debug) <<
"BmnFillDstTask::Init(): branch MCTrack not found" << endl;
317 ioman->Register(
"BmnMCInfo.",
"MC", fMCInfoDst, kTRUE);
345 LOG(debug) <<
"Exec of BmnFillDstTask";
349 if (isExpData == 0) {
351 fDstHeader->SetRunId(fMCEventHeader->GetRunID());
352 fDstHeader->
SetEventId(fMCEventHeader->GetEventID());
353 fDstHeader->SetEventTime(fMCEventHeader->GetT());
355 fDstHeader->
SetB(fMCEventHeader->GetB());
358 fMCInfoDst->
SetB(fMCEventHeader->GetB());
359 fMCInfoDst->
SetVertex(fMCEventHeader->GetX(), fMCEventHeader->GetY(), fMCEventHeader->GetZ());
360 fMCInfoDst->
SetRotX(fMCEventHeader->GetRotX());
361 fMCInfoDst->
SetRotY(fMCEventHeader->GetRotY());
362 fMCInfoDst->
SetRotZ(fMCEventHeader->GetRotZ());
363 fMCInfoDst->
GetMCTracks()->AbsorbObjects(fMCTracks);
365 fDstHeader->SetRunId(fEventHeader->GetRunId());
367 fDstHeader->SetEventTime(fEventHeader->GetEventTime());
372 Double_t Z2in = -100.0, Z2out = -100.0;
373 Double_t adcIn = -100.0, adcOut = -100.0;
376 if (fT0 && fBC1 && fBC2 && fBC3 && fBC4) {
379 for (Int_t
i = 0;
i < fT0->GetEntriesFast();
i++) {
385 Double_t t0Time = digT0->
GetTime();
387 grabZ2(fBC1, fBC2, t0Time, Z2in, adcIn, fBC1Calib, fBC2Calib, Zin,
true);
388 grabZ2(fBC3, fBC4, t0Time, Z2out, adcOut, 0, 0, Zout,
false);
389 if (Z2out != -1000) {
391 Z2out = Z2out * fZCalib1 + fZCalib2;
392 Z2out = Z2out * Z2out;
401 }
else if (fT0 && fBC1 && fBC2) {
404 for (Int_t
i = 0;
i < fT0->GetEntriesFast();
i++) {
410 Double_t t0Time = digT0->
GetTime();
412 grabZ2(fBC1, fBC2, t0Time, Z2in, adcIn, fBC1Calib, fBC2Calib, Zin,
true);
421 Double_t Z1 = -100.0, Z2 = -100.0, Z3 = -100.0, Z4 = -100.0, ADC1 = -100.0, ADC2 = -100.0, ADC3 = -100.0,
426 Double_t t0Time = -100000;
427 for (Int_t
i = 0;
i < fT0->GetEntriesFast();
i++) {
429 if (digT0->
GetMod() == 0) {
436 grabZ2OR(fBC1, fBC2, t0Time, Z1, Z2, ADC1, ADC2,
true);
439 grabZ2OR(fBC3, fBC4, t0Time, Z3, Z4, ADC3, ADC4,
false);
456 if (fVerbose == -9999) {
457 if (gROOT->IsBatch()) {
458 if (fIEvent % 1000 == 0)
459 printf(
"%lld/%lld\n", fIEvent, fNEvents);
461 UInt_t fRunId = (fDstHeader) ? fDstHeader->GetRunId() : 0;
471 Float_t progress = fIEvent * 1.0 / fNEvents;
474 Int_t pos = barWidth * progress;
475 for (Int_t
i = 0;
i < barWidth; ++
i) {
489 LOG(info) <<
"Event #" << fNStartEvent + fIEvent;
490 if (fPrimaryVertex) {
491 TString strVertex = TString::Format(
" vertex = %.3f:%.3f:%.3f", fPrimaryVertex->
GetX(),
492 fPrimaryVertex->
GetY(), fPrimaryVertex->
GetZ());
493 LOG(info) << strVertex.Data();
496 LOG(info) <<
"\tglobal tracks = " << fGlobalTracks->GetEntries();
500 if (fIEvent == fNEvents)
504 workTime += sw.RealTime();
590 mapParticleInfo.insert(pair<TString, stParticleInfo>(
"d", particle_info));
591 particle_info.
A = 12;
593 mapParticleInfo.insert(pair<TString, stParticleInfo>(
"c", particle_info));
594 particle_info.
A = 40;
595 particle_info.
Z = 18;
596 mapParticleInfo.insert(pair<TString, stParticleInfo>(
"ar", particle_info));
597 particle_info.
A = 84;
598 particle_info.
Z = 36;
599 mapParticleInfo.insert(pair<TString, stParticleInfo>(
"kr", particle_info));
600 particle_info.
A = 27;
601 particle_info.
Z = 13;
602 mapParticleInfo.insert(pair<TString, stParticleInfo>(
"al", particle_info));
603 particle_info.
A = 207;
604 particle_info.
Z = 82;
605 mapParticleInfo.insert(pair<TString, stParticleInfo>(
"pb", particle_info));
606 particle_info.
A = 119;
607 particle_info.
Z = 50;
608 mapParticleInfo.insert(pair<TString, stParticleInfo>(
"sn", particle_info));
609 particle_info.
A = 64;
610 particle_info.
Z = 29;
611 mapParticleInfo.insert(pair<TString, stParticleInfo>(
"cu", particle_info));
614 mapParticleInfo.insert(pair<TString, stParticleInfo>(
"h2", particle_info));
615 particle_info.
A = 29;
617 mapParticleInfo.insert(pair<TString, stParticleInfo>(
"c2h4", particle_info));