9#include "FairRootManager.h"
112 cout << this->GetName() <<
"::LoadDetectorConfiguration(): No " <<
fDetName
113 <<
" detectors in geometry file for the current run! Task will be deactivated" << endl;
118 cout << this->GetName() <<
"::LoadDetectorConfiguration(): number of " <<
fDetName
119 <<
" Detectors from geometry file = " <<
fNDetectors << endl;
124 cout << this->GetName()
125 <<
"::LoadDetectorConfiguration(): No corrections for the current run! Task will be deactivated"
133 Int_t DoTestForDetector =
136 DoTestForDetector = 1;
149 pDetector[
i]->SetSpeedOfSignal(
"CorreSpeed.txt");
177 TString fFlnmOut = (
dynamic_cast<TFile*
>(FairRootManager::Instance()->GetOutFile())->
GetName());
182 cout << endl <<
"!!!!!!!!!! !!!!!!!!!!!!!!!!!!" << endl;
184 cout <<
"!!!!!!!!!! !!!!!!!!!!!!!!!!!!" << endl << endl;
198 cout <<
" Only primary particles are processed!!! \n";
203 cout << this->GetName() <<
"::Init(): branch " <<
fPointsName.Data()
204 <<
" not found! Task will be deactivated" << endl;
210 cout << this->GetName() <<
"::Init(): branch MCTrack not found! Task will be deactivated" << endl;
216 cout << this->GetName() <<
"::Init(): DetectorId is incorrect. Use kTOF1 or kTOF701." << endl;
223 "\n\t!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"
224 "\t!!!!!!!!!!!!!!! %s !!!!!!!!!!!!!\n"
225 "\tThis task is not suitable for this period/run (Period #%d, Run #%d).\n"
226 "\tPlease use the legacy code for the Tof700HitProduser task.\n"
227 "\tFor this purpose, use some old(?) version of bmnroot.\n"
228 "\t!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"
239 cout << this->GetName() <<
"::Init(): branch" <<
fDigitsName.Data()
240 <<
" is not found! Task will be deactivated" << endl;
246 TString NameT0Branch, NameT0Branch2;
250 NameT0Branch =
"BC2";
253 NameT0Branch =
"T0_1_A";
254 NameT0Branch2 =
"T0_2_A";
257 NameT0Branch =
"BC2AT";
258 NameT0Branch2 =
"BC2AB";
263 NameT0Branch =
"BmnTrigInfo.";
267 LOG(info) << this->GetName() <<
"::Init(): looking for branch " << NameT0Branch <<
" for start" << endl;
275 this->GetName(), NameT0Branch.
Data());
282 cout << this->GetName() <<
"::Init(): looking for branch " << NameT0Branch2 <<
" for start" << endl;
286 this->GetName(), NameT0Branch2.
Data());
304 "\n=================== %s::Init(): Initialization finished succesfully. ==\n\n" ANSI_COLOR_RESET,
311 const Bool_t& isWide_strip)
314 const static Double_t slope = (0.98 - 0.95) / 0.2;
315 Double_t efficiency = (val > 0.2) ? 0.98 : (0.95 + slope * val);
327 if (
pRandom->Rndm() < efficiency)
334 const Bool_t& isWide_strip,
335 const DetectorId& flag)
352 if (flag ==
kTOF701 && isWide_strip) {
353 fEffFunc->SetParameters((0.05 - 0.409) / 0.9375, 0.409);
356 else if (flag ==
kTOF701 && !isWide_strip)
357 fEffFunc->SetParameters((0.05 - 0.44) / 0.5492, 0.44);
360 fEffFunc->SetParameters((0.05 - 0.339) / 0.625, 0.339);
364 if (
pRandom->Rndm() < efficiency)
371 const Bool_t& isWide_strip,
372 const DetectorId& flag)
375 if (flag ==
kTOF701 && isWide_strip)
376 fEffFunc->SetParameters((0.078 - 0.01) / 0.9375, 0.078);
378 else if (flag ==
kTOF701 && !isWide_strip)
379 fEffFunc->SetParameters((0.095 - 0.01) / 0.5492, 0.095);
382 fEffFunc->SetParameters((0.075 - 0.01) / 0.625, 0.075);
386 if (
pRandom->Rndm() < efficiency)
401 printf(
"\n=================== %s::Exec(): Started ====================\n", this->GetName());
408 int nSingleHits = 0, nDoubleHits = 0, nTripleHits = 0;
411 for (
Int_t pointIndex = 0, nTofPoint =
aMcPoints->GetEntriesFast(); pointIndex < nTofPoint;
418 trackID = pPoint->GetTrackID();
420 detID = (DetectorId)pPoint->GetDetectorID();
422 pPoint->Position(pos);
425 const LStrip1*
const pcStrip = pStrip;
426 if (pStrip == NULL) {
427 printf(
"UID is incorrect: UID = %d", UID);
431 Bool_t isWide_strip =
false;
448 printf(
"!!!!! WRONG DetectorID for %s reconstruction\n",
fDetName.Data());
468 if ((passed =
HitExist(distance, isWide_strip)) ==
true)
473 AddHit(UID, XYZ_smeared, XYZ_err, pointIndex, trackID, time, detID);
505 printf(
"!!!!! WRONG DetectorID for %s reconstruction\n",
fDetName.Data());
514 AddHit(CrossUID, XYZ_smeared, XYZ_err, pointIndex, trackID, time, detID);
522 if ((passed &&
TripleHitExist(distance, isWide_strip, detID)) ==
true) {
537 printf(
"!!!!! WRONG DetectorID for %s reconstruction\n",
fDetName.Data());
542 AddHit(CrossUID, XYZ_smeared, XYZ_err, pointIndex, trackID, time, detID);
585 cout <<
fDetName <<
": single hits= " << nSingleHits <<
", double hits= " << nDoubleHits
586 <<
", triple hits= " << nTripleHits <<
", final hits= " << nFinally << endl;
587 printf(
"\n=================== %s::Exec(): Finished ===================\n", this->GetName());
607 printf(
"Work time of %s: %4.2f sec.\n", this->GetName(),
workTime);
627 if (digT0->
GetMod() == 0) {
663 FlagHitBotom =
kTRUE;
668 if (FlagHitTop && FlagHitBotom) {
693 NameFile =
Form(
"%s%s%s", getenv(
"VMCWORKDIR"),
"/input/", NameFile.Data());
695 Temp.open(NameFile, ios::in );
696 return Temp.is_open();
798 <<
" for LR correction is not found" << endl;
799 cout <<
"Check /input folder for file" << endl;
808 <<
" for Slewing correction is not found" << endl;
809 cout <<
"Check /input folder for file" << endl;
818 <<
" for TimeShift correction is not found" << endl;
819 cout <<
"Check /input folder for file" << endl;
860 nRuntemp = fntemp.
Atoi();
871 nRuntemp = fntemp.
Atoi();
char * Form(const char *fmt,...)
Int_t GetVolumeUID() const
virtual void Print(const Option_t *opt) const
TClonesArray * aMcTracks
<— MC input
TClonesArray * aTofHits
<— The T0 time is stored in 'BmnTrigInfo.' branch in Run9
void AddHit(Int_t detUID, const TVector3 &posHit, const TVector3 &posHitErr, Int_t pointIndex, Int_t trackIndex, Double_t time, Int_t Idd)
TClonesArray * aTofCont
---> output
TClonesArray * aExpDigitsT0
<— Exp input
BmnTrigInfoDst * aExpTrigInfo
<— Exp input for run8 SRC
BmnTof1HitProducerIdeal(const char *name="TOF1 Ideal HitProducer", Bool_t useMCdata=true, Int_t verbose=1, Bool_t DoTest=false, Bool_t DoMergeHits=false)
TFile * fileCont
---> output
TClonesArray * aExpDigitsT0_2
<— Exp input
TClonesArray * aExpDigits
<— MC input
Bool_t FlagFileLRcorrection
BmnTrigDigit * FingT0Digit()
Int_t extract_number_ev(TString fn)
void SetSeed(UInt_t seed=0)
virtual InitStatus Init()
Bool_t FlagFileTimeShiftCorrection
virtual void Exec(Option_t *opt)
Bool_t OutOfRange(Int_t iPlane)
void SetPeriodRun(Int_t p, Int_t r)
Bool_t TripleHitExist(const Double_t &val, const Bool_t &isWide_strip, const DetectorId &flag)
TString extract_path(TString fn)
Int_t extract_number_p(TString fn)
InitStatus LoadDetectorConfiguration()
Bool_t IsFile(TString NameFile)
virtual ~BmnTof1HitProducer()
BmnTOF1Detector ** pDetector
BmnTof1GeoUtils * pGeoUtils
TString NameFileLRcorrection
BmnTof1HitProducer(const char *name, DetectorId detId, Bool_t useMCdata=true, Int_t verbose=1, Bool_t DoTest=false)
TString NameFileTimeShiftCorrection
Bool_t HitExist(const Double_t &val, const Bool_t &isWide_strip)
Bool_t FlagFileSlewingCorrection
virtual void OnlineWrite(const std::unique_ptr< TTree > &resultTree)
Write task resul to tree.
BmnEventHeader * fEventHeader
Bool_t DoubleHitExist(const Double_t &val, const Bool_t &isWide_strip, const DetectorId &flag)
TString NameFileSlewingCorrection
void SetTime(Double_t time)
void SetAmp(Double_t amp)
Double_t MinDistanceToEdge701(const TVector3 *pos, Side_t &side) const
Double_t MinDistanceToEdge(const TVector3 *pos, Side_t &side) const
const char * GetName() const override
void Start(Bool_t reset=kTRUE)
const char * Data() const
Ssiz_t Last(char c) const
TString & Remove(EStripType s, char c)
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
void SetXYZ(Double_t x, Double_t y, Double_t z)
RVec< PromoteType< T > > sqrt(const RVec< T > &v)