Go to the documentation of this file.
18 #include "TClonesArray.h"
20 #include "TGeoMatrix.h"
21 #include "TGeoPhysicalNode.h"
22 #include "TGeoVolume.h"
23 #include <TMCProcess.h>
26 #include "FairEventHeader.h"
27 #include "FairField.h"
29 #include "FairLogger.h"
30 #include "FairMCEventHeader.h"
31 #include "FairMCPoint.h"
32 #include "FairRunAna.h"
33 #include "FairRunSim.h"
34 #include "FairRuntimeDb.h"
61 using std::setprecision;
64 using std::stringstream;
72 , fIsInitialised(kFALSE)
80 , fSensorPitch(0.0058)
83 , fSensorParameterFile()
84 , fSensorConditionFile()
85 , fModuleParameterFile()
88 , fTimeDigiLast(-1.) {
108 entry.second->BufferStatus(nSigModule, t1Module, t2Module);
109 nSignals += nSigModule;
129 entry.second->BufferStatus(nSigModule, t1Module, t2Module);
131 nSignals += nSigModule;
132 t1 = t1 < 0. ? t1Module : TMath::Min(t1, t1Module);
133 t2 = TMath::Max(t2, t2Module);
137 std::stringstream ss;
138 ss << nSignals << (nSignals == 1 ?
" signal " :
" signals ")
139 <<
"in analogue buffers";
141 ss <<
" ( from " << fixed << setprecision(3) << t1 <<
" ns to " << t2
180 if (gLogger->IsLogNeeded(fair::Severity::debug)) {
181 std::cout << std::endl;
192 Double_t tNoiseStart =
fNofEvents ? eventTimePrevious : 0.;
195 nNoise += entry.second->GenerateNoise(tNoiseStart, tNoiseEnd);
197 LOG(info) <<
"+ " << setw(20) << GetName() <<
": Generated " << nNoise
198 <<
" noise signals from t = " << tNoiseStart <<
" ns to "
199 << tNoiseEnd <<
" ns";
208 if (gLogger->IsLogNeeded(fair::Severity::debug)) {
223 if (gLogger->IsLogNeeded(fair::Severity::debug)) {
228 LOG(info) << left << setw(15) << GetName() <<
"[" << fixed << setprecision(3)
229 <<
fTimer.RealTime() <<
" s]"
258 LOG(fatal) << fName <<
": Non-empty analogue buffers at end of event "
259 <<
" in event-by-event mode!";
265 std::cout << std::endl;
266 LOG(info) << GetName() <<
": Finish run";
268 LOG(info) << GetName() <<
": Processing analogue buffers";
272 entry.second->ProcessAnalogBuffer(-1.);
277 << (
fNofDigis == 1 ?
" digi " :
" digis ") <<
"created and sent to DAQ ";
279 ss <<
"( from " << fixed << setprecision(3) <<
fTimeDigiFirst <<
" ns to "
281 LOG(info) << ss.str();
293 std::cout << std::endl;
294 LOG(info) <<
"=====================================";
295 LOG(info) << GetName() <<
": Run summary";
296 LOG(info) <<
"Events processed : " <<
fNofEvents;
297 LOG(info) <<
"Points processed / evt : " << fixed << setprecision(1)
299 LOG(info) <<
"Points ignored / evt : " << fixed << setprecision(1)
301 LOG(info) <<
"Signals / event : "
304 LOG(info) <<
"StsDigi / event : "
306 LOG(info) <<
"Digis per point : " << setprecision(6)
308 LOG(info) <<
"Digis per signal : "
310 LOG(info) <<
"Noise digis / event : "
315 LOG(info) <<
"=====================================";
322 assert(FairRunAna::Instance());
323 FairRuntimeDb* rtdb = FairRunAna::Instance()->GetRuntimeDb();
330 rtdb->getContainer(
"CbmStsParSetSensorCond"));
339 std::cout << std::endl;
340 LOG(info) <<
"==========================================================";
341 LOG(info) << GetName() <<
": Initialisation \n\n";
355 LOG(info) << GetName() <<
": Created " << nModules <<
" modules";
359 LOG(info) << GetName() <<
": Created " << nSensors <<
" sensors";
363 FairRootManager* ioman = FairRootManager::Instance();
367 fPoints = (TClonesArray*) ioman->GetObject(
"StsPoint");
371 fTracks = (TClonesArray*) ioman->GetObject(
"MCTrack");
377 LOG(info) << GetName() <<
": Initialisation successful";
378 LOG(info) <<
"==========================================================";
379 std::cout << std::endl;
401 auto result =
fModules.insert({address, module});
402 assert(result.second);
406 assert(nModules ==
fModules.size());
432 fParSim->setInputVersion(-2, 1);
444 LOG(info) <<
"--- Using global ASIC parameters: \n "
457 TGeoBBox* box =
dynamic_cast<TGeoBBox*
>(sensor->
GetPnode()->GetShape());
459 Double_t lX = 2. * box->GetDX();
460 Double_t lY = 2. * box->GetDY();
461 Double_t lZ = 2. * box->GetDZ();
469 Double_t nStripsF = dX / pitchF;
470 Double_t nStripsB = dX / pitchB;
474 && TMath::Abs(lX - 6.2092) < 0.0001
475 && TMath::Abs(pitchF - 0.0058) < 0.0001) {
482 && TMath::Abs(lX - 6.2) < 0.0001
483 && TMath::Abs(pitchF - 0.0058) < 0.0001) {
496 for (UInt_t parIndex = 6; parIndex < 10; parIndex++) {
535 auto moduIt =
fModules.find(moduAddress);
537 assert(moduIt->second);
545 assert(result.second);
546 auto& sensor = result.first->second;
550 sensor->SetElement(geoSensor);
551 sensor->SetModule(moduIt->second);
554 sensor->SetSimSettings(
fParSim);
559 sensor->SetConditions(&cond);
565 if (FairRun::Instance()->GetField()) {
566 Double_t local[3] = {0., 0., 0.};
568 geoSensor->
GetPnode()->GetMatrix()->LocalToMaster(local, global);
569 Double_t field[3] = {0., 0., 0.};
570 FairRun::Instance()->GetField()->Field(global, field);
575 sensor->SetField(bx, by, bz);
578 assert(sensor->Init());
583 assert(nSensors ==
fSensors.size());
612 it.second->ProcessAnalogBuffer(readoutTime);
622 for (Int_t iPoint = 0; iPoint <
fPoints->GetEntriesFast(); iPoint++) {
628 Int_t iTrack = point->GetTrackID();
653 UInt_t address =
static_cast<UInt_t
>(point->GetDetectorID());
655 auto& sensor =
fSensors.find(address)->second;
657 Int_t status = sensor->ProcessPoint(point, eventTime, link);
660 Int_t nSignalsF = status / 1000;
661 Int_t nSignalsB = status - 1000 * nSignalsF;
662 LOG(debug2) << GetName() <<
": Produced signals: " << nSignalsF + nSignalsB
663 <<
" ( " << nSignalsF <<
" / " << nSignalsB <<
" )";
704 Bool_t eventMode = kFALSE;
706 Bool_t lorentzShift = kTRUE;
707 Bool_t diffusion = kTRUE;
708 Bool_t crossTalk = kTRUE;
709 Bool_t generateNoise = kTRUE;
720 Double_t dynRange = 75000.;
721 Double_t threshold = 3000.;
722 Double_t timeResol = 5.;
723 Double_t deadTime = 800.;
724 Double_t noiseRms = 1000.;
725 Double_t znr = 3.9789e-3;
727 nAdc, dynRange, threshold, timeResol, deadTime, noiseRms, znr);
731 UInt_t nChannels = 2048;
732 UInt_t nAsicChannels = 128;
741 Double_t pitchF = 0.0058;
742 Double_t pitchB = 0.0058;
743 Double_t stereoF = 0.;
744 Double_t stereoB = 7.5;
754 Double_t vBias = 140.;
755 Double_t temperature = 268.;
756 Double_t cCoupling = 17.5;
757 Double_t cInterstrip = 1.;
768 Double_t timeResolution,
771 Double_t zeroNoiseRate) {
776 nAdc, dynRange, threshold, timeResolution, deadTime, noise, zeroNoiseRate);
783 UInt_t nAsicChannels) {
795 Double_t temperature,
797 Double_t cInterstrip) {
818 Bool_t useLorentzShift,
820 Bool_t useCrossTalk) {
822 LOG(error) << GetName() <<
": physics processes must be set before "
823 <<
"initialisation! Statement will have no effect.";
828 eLossModel, useLorentzShift, useDiffusion, useCrossTalk);
837 LOG(fatal) << GetName()
838 <<
": sensor conditions must be set before initialisation!";
850 LOG(fatal) << GetName()
851 <<
": sensor parameters must be set before initialisation!";
UInt_t InitSensors()
Instantiate sensors.
virtual void clear()
Reset all parameters.
std::map< UInt_t, CbmStsSimModule * > fModules
TString fSensorConditionFile
File with sensor conditions.
Double_t fTimeDigiLast
Time of last digi sent to DAQ.
void GetEventInfo()
Get event information.
Bool_t fCreateMatches
Flag for production of inter-event noise.
void SetGlobalAsicParams(UInt_t nAdc, Double_t dynRange, Double_t threshold, Double_t timeResolution, Double_t deadTime, Double_t noise, Double_t zeroNoiseRate)
Set individual module parameters.
TClonesArray * fTracks
Input array of CbmMCTrack.
TString fSensorParameterFile
File with sensor parameters.
UInt_t SetSensorConditions(CbmStsParSetSensorCond *conds)
Set sensor conditions from parameter container.
std::string ToString() const
Info to string.
void SetAllAsics(const CbmStsParAsic &asicPar)
Set all ASICs with the same parameter set.
Bool_t fIsInitialised
kTRUE if Init() was called
Parameters for operating conditions of a STS sensor.
Int_t fNofDigis
Number of created digis in Exec.
CbmStsParSim * fUserParSim
Settings for simulation.
Int_t BufferSize() const
Number of signals in the analogue buffers @value nSignals Sum of number of signals in all modules.
CbmStsParModule * fUserParModule
User defined, global.
static CbmStsSetup * Instance()
Task class for simulating the detector response of the STS.
Int_t fCurrentMCEntry
Number of current MC event.
CbmStsSensorClass GetClass() const
Get the sensor class.
Int_t fNofEvents
Total number of procesed events.
void ProcessAnalogBuffers(Double_t readoutTime)
CbmStsParSetSensor * fParSetSensor
Sensor parameters.
UInt_t SetSensorParameters(CbmStsParSetSensor *parSet)
Set sensor parameters from parameter container.
Int_t fNofSignalsB
Number of signals on back side.
CbmStsParSensor * fUserParSensor
User defined, global.
Int_t fNofPointsProc
Number of processed points.
Int_t fNofSignalsF
Number of signals on front side.
void SetGlobalPar(Double_t vDep, Double_t vBias, Double_t temperature, Double_t cCoupling, Double_t cInterstrip)
Set global conditions (for all sensors)
TClonesArray * fPoints
Sensor factory.
void SetSensorConditionFile(const char *fileName)
Set the file name with sensor conditions.
void ResetCounters()
Reset event counters.
std::string ToString() const
String output.
virtual void clear()
Reset all parameters.
virtual ~CbmStsDigitize()
static CbmStsPhysics * Instance()
Accessor to singleton instance.
void SetParSensor(UInt_t address, const CbmStsParSensor &par)
Set the parameters for a sensor.
const CbmStsParModule & GetParModule(UInt_t address)
Get condition parameters of a sensor.
TGeoPhysicalNode * GetPnode() const
std::string ToString() const
Info to string.
Parameters container for CbmStsParSensorCond.
Double_t fNofNoiseTot
Total number of noise digis.
Constructional parameters of a STS sensor.
virtual void SetParContainers()
Inherited from FairTask.
std::string ToString()
Info to string.
const CbmStsParSensor & GetParSensor(UInt_t address)
Get condition parameters of a sensor.
Double_t fNofPointsProcTot
Total number of processed points.
void SetEventMode(Bool_t choice=kTRUE)
Set event-by-event simulation mode.
Parameters container for CbmStsParSensor.
Bool_t fProduceNoise
Flag for event-by-event mode.
CbmStsELoss
Energy loss model used in simulation.
std::string BufferStatus() const
Status of the analogue buffers.
Base class template for CBM digitisation tasks.
Parameters of the STS readout ASIC.
UP_sensor CreateSensor(const CbmStsParSensor &par)
Create a sensor.
Double_t fNofSignalsBTot
Number of signals on back side.
Int_t fNofPointsIgno
Number of ignored points.
Bool_t OnlyPrimaries() const
Process only primary tracks.
virtual void clear()
Reset all parameters.
Parameters for one STS module.
CbmStsSensor * GetSensor(Int_t index) const
Get a sensor from the sensor array.
Double_t fUserDinactive
Size of inactive sensor border [cm].
void SetSensorParameterFile(const char *fileName)
Set the file name with sensor parameters.
std::map< UInt_t, std::unique_ptr< CbmStsSimSensor > > fSensors
Bool_t Noise() const
Check whether inter-event noise is generated.
void CreateDigi(Int_t address, UShort_t channel, Long64_t time, UShort_t adc, const CbmMatch &match)
TStopwatch fTimer
ROOT timer.
Int_t fCurrentInput
Flag for creation of links to MC.
ClassImp(CbmConverterManager) InitStatus CbmConverterManager
UInt_t GetGeantProcessId() const
Double_t fCurrentEventTime
Number of current MC entry.
Class representing an instance of a sensor in the CBM-STS.
Bool_t Init(const char *geometryFile=nullptr)
Initialise the setup.
Data class for a single-channel message in the STS.
Double_t fNofDigisTot
Total number of digis created.
void ProcessPoint(const CbmStsPoint *point, Double_t eventTime=0., CbmLink *link=NULL)
CbmStsSensorClass
Sensor classes.
CbmStsParSetModule * fParSetModule
Module parameter.
void SendData(CbmStsDigi *digi, CbmMatch *match=nullptr)
Send a digi and the corresponding match object to the DAQ.
CbmStsModule * GetModule(Int_t index) const
Get a module from the module array.
void UseOnlyPrimaries(Bool_t flag=kTRUE)
Discard processing of secondary tracks.
CbmStsParSensorCond * fUserParCond
User defined, global.
void SetGlobalDefaults()
Set global default parameters.
TString fModuleParameterFile
File with module parameters.
Double_t fNofPointsIgnoTot
Total number of ignored points.
void SetProcesses(CbmStsELoss eLossModel, Bool_t useLorentzShift, Bool_t useDiffusion, Bool_t useCrossTalk)
UInt_t InitModules()
Instantiate modules.
virtual void Exec(Option_t *opt)
Float_t GetPar(UInt_t index) const
Get a parameter.
UInt_t SetModuleParameters(CbmStsParSetModule *modulePars)
Set module parameters from parameter container.
Settings for STS simulation (digitizer)
void SetGenerateNoise(Bool_t choice=kTRUE)
Activate or de-activate inter-event noise.
void SetGlobalModuleParams(UInt_t nChannels, UInt_t nAsicChannels)
Set the global module parameters.
Double_t fTimeDigiFirst
Time of first digi sent to DAQ.
CbmStsParAsic * fUserParAsic
User defined, global.
Parameters container for CbmStsParModule.
void SetGlobalPar(const CbmStsParModule ¶ms)
Set global parameters (for all modules)
CbmStsParSim * fParSim
Simulation settings.
CbmStsElement * GetMother() const
void RegisterOutput()
Register the output arrays.
CbmStsSimSensorFactory * fSensorFactory
STS setup interface.
Int_t GetNofSensors() const
void InitParams()
Initialise the parameters.
virtual InitStatus ReInit()
Class for the simulation of a readout unit in the CBM-STS.
Double_t fTimeTot
Total execution time.
void SetOnlyPrimaries(Bool_t choice=kTRUE)
Process only primary tracks.
void SetModuleParameterFile(const char *fileName)
Set the file name with module parameters.
std::string ToString() const
Info to string.
Int_t GetNofModules() const
Class representing an element of the STS setup.
Double_t fNofSignalsFTot
Number of signals on front side.
const CbmStsParSensorCond & GetParSensor(UInt_t address)
Get condition parameters of a sensor.
virtual InitStatus Init()
CbmStsParSetSensorCond * fParSetCond
Sensor conditions.
void SetGlobalSensorConditions(Double_t vDep, Double_t vBias, Double_t temperature, Double_t cCoupling, Double_t cInterstrip)
Set the global sensor conditions.
void SetProcesses(CbmStsELoss eLossModel, Bool_t useLorentzShift=kTRUE, Bool_t useDiffusion=kTRUE, Bool_t useCrossTalk=kTRUE)
void SetPar(UInt_t index, Float_t value)
Set a parameter.