9#include "BmnVSPStationSet.h"
19#include "FairGeoMedium.h"
20#include "FairGeoNode.h"
21#include "FairGeoTransform.h"
22#include "FairGeoVector.h"
23#include "FairLogger.h"
24#include "FairRunAna.h"
25#include "FairRuntimeDb.h"
93 FairRuntimeDb* rtdb = FairRuntimeDb::instance();
102 Init(geoPar, digiPar);
123 cout <<
"-W- CbmStsDigiScheme::Init: "
124 <<
"No digitisation parameters available!" << endl;
132 LOG(error) <<
"gGeoManager has null pointer";
157 cout <<
"-E- CbmStsDigiScheme::Init: unknown geometry version" << endl;
178 for (
Int_t iStation = 0; iStation <
fStations->GetEntries(); iStation++)
213 return (
GetStationByNr(stationNr)->GetSectorByNr(sectorNr)->GetSensorByNr(sensorNr));
220 map<TString, Int_t>::iterator p;
226 cout <<
" -E- StsDigiScheme::GetDetectorIdByName \"" << sensorName.
Data() <<
"\" not found " << endl;
235 map<TString, CbmStsSensor*>::iterator p;
241 LOG(debug) <<
"StsDigiScheme: sensor " << sensorName.
Data() <<
" not found ";
251 cout <<
"=================== STS digitisation scheme =================" << endl;
254 station->
Print(kLong);
256 cout <<
"================================================================" << endl << endl;
279 TString gemSet =
"GemRun8.xml";
280 TString silSet =
"SiliconRun8.xml";
283 silSet =
"SiliconRun9.xml";
284 gemSet =
"GemRun9.xml";
285 vspSet =
"VSP_Run9.xml";
303 for (
Int_t iSt = 0; iSt < nVspStat; ++iSt) {
309 statRadLength, 0, statRmax, 0);
314 Int_t detId =
kVSP << 24 | (iSt + 1) << 16 | (iMod + 1) << 4 | 1 << 1;
324 new CbmStsSensor(
"", detId, 2, x0, y0, z0, 0, siModule->
GetXSize(), siModule->
GetYSize(), d0, 0.01, 0.0,
341 for (
Int_t iSt = 0; iSt < nSiStat; ++iSt) {
350 statD, statRadLength, 0, statRmax, 0);
354 Int_t detId =
kSILICON << 24 | (iSt + 1) << 16 | (iMod + 1) << 4 | 1 << 1;
384 Form(
"stat%02d", iSt + 1 + nSiStat + nVspStat), iSt + 1 + nSiStat + nVspStat,
385 gemStation->
GetZPosition(), statD, statRadLength, statRmin, statRmax, 0);
405 int sect = (iMod % 2) * 2 + (iMod / 2 * 4) + 1 + iL / 2;
406 Int_t detId =
kGEM << 24 | (iSt + 1 + nSiStat) << 16 | sect << 4 | sens << 1;
415 CbmStsSensor* sensor =
new CbmStsSensor(
"", detId, 2, x0, y0, z0, 0, xSize, ySize, d0, 0.08, 0.0, 0.0,
423 fStationMap[iSt + nSiStat + nVspStat + 1] = station;
613 Int_t statNr = 0, stNr = 0;
619 cout <<
"NODE: " << name << endl;
631 cout <<
" xxxxxxxxx " << name << endl;
636 cout <<
"-E- CbmStsDigiScheme::InitNew: Cannot find top GEM node" << endl;
652 if (!statName.
Contains(
"station")) {
656 cout <<
"station: " << iNode <<
" " << sts->
GetNdaughters() <<
" " << statName << endl;
674 stationPar = partest1;
679 cout <<
"-E- CbmStsDigiScheme::InitNew: No parameters for station " << statNr << endl;
686 statName =
Form(
"stat%02d", statNr);
708 new CbmStsStation(statName, statNr, statZ, statD, statRadLength, statRmin, statRmax, statRot);
721 for (
Int_t iModule = 0; iModule < nModules; iModule++) {
727 cout <<
"moduleName: " << moduleName << endl;
756 cout << nModules <<
" " <<
gGeoManager->GetCurrentNode()->GetName() <<
" "
757 <<
gGeoManager->GetCurrentMatrix()->GetTranslation()[2] << endl;
765 AddHotZone(++moduleNr, statNr, station, stationPar);
771 for (
Int_t iSensor = 0; iSensor < nSensors; iSensor++) {
810 cout <<
"-E- CbmStsDigiScheme::GetCurrentPath:: No TGeoManager" << endl;
817 path =
"/" + nodeName + path;
843 sectorPar = partest2;
848 cout <<
"-E- CbmStsDigiScheme::SetSensor: No parameters for module " << moduleNr <<
", station " << statNr
854 TString sectName =
Form(
"stat%02dsect%d", statNr, moduleNr);
855 Int_t sectId = 2 << 24 | statNr << 16 | moduleNr << 4;
867 sensorPar = partest3;
872 cout <<
"-E- CbmStsDigiScheme::SetSensor: No parameters for sensor " << sensNr <<
", module " << moduleNr
873 <<
", station " << statNr << endl;
879 Int_t sensId = 2 << 24 | statNr << 16 | moduleNr << 4 | sensNr << 1;
902 sensD, sensDx, sensDy, sensStereoF, sensStereoB);
905 cout <<
"-E- CbmStsDigiScheme: Duplicate sensor name " << sensName << endl;
911 cout <<
"-E- CbmStsDigiScheme: Duplicate sensor name " << sensName << endl;
931 TGeoNode* ladder = geoMan->GetCurrentNode();
933 Int_t modNr0 = moduleNr;
936 for (
Int_t i2 = 0; i2 < nD; i2++) {
942 TGeoNode* halflad = geoMan->GetCurrentNode();
946 for (
Int_t imod = 0; imod < nHalfLadD; imod++) {
949 geoMan->CdDown(imod);
952 SetSensor(moduleNr, statNr, statCBM, stationPar);
961 return moduleNr - modNr0;
980 sectorPar = partest2;
985 cout <<
"-E- CbmStsDigiScheme::SetSensor: No parameters for module " << moduleNr <<
", station " << statNr
989 cout <<
" mod, sectors: " << moduleNr <<
" " << stationPar->
GetNSectors() <<
" " << sectorPar->
GetNSensors()
993 TString sectName =
Form(
"stat%02dsect%d", statNr, moduleNr);
994 Int_t sectId = 2 << 24 | statNr << 16 | moduleNr << 4;
1006 sensorPar = partest3;
1011 cout <<
"-E- CbmStsDigiScheme::SetSensor: No parameters for sensor " << sensNr <<
", module " << moduleNr
1012 <<
", station " << statNr << endl;
1019 sensName +=
"/hotZone";
1020 Int_t sensId = 2 << 24 | statNr << 16 | moduleNr << 4 | sensNr << 1;
1034 if (sensDx > 0.02) {
1036 if (statNr % 2 == 1)
1043 sensD, sensDx, sensDy, sensStereoF, sensStereoB);
1046 cout <<
"-E- CbmStsDigiScheme: Duplicate sensor name " << sensName << endl;
1052 cout <<
"-E- CbmStsDigiScheme: Duplicate sensor name " << sensName << endl;
1068 cout <<
" AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA " << endl;
1076 cout <<
"NODE: " << name << endl;
1084 cout <<
"-E- CbmStsDigiScheme::AddHotZones: Cannot find top GEM node" << endl;
1099 if (!statName.
Contains(
"station")) {
1103 cout <<
" Station: " << iNode <<
" " << sts->
GetNdaughters() <<
" " << statName << endl;
1110 for (
Int_t iModule = 0; iModule < nModules; iModule++) {
1114 cout <<
" ModuleName: " << moduleName << endl;
1115 if (!(moduleName.
Contains(
"Sensor_module"))) {
1120 Double_t hzone[3] = {20, 15.0 / 2, 0};
1126 cout << wxyzMain[0] <<
" " << wxyzMain[1] <<
" " << wxyzMain[2] << endl;
1127 cout << tr[0] <<
" " << tr[1] <<
" " << tr[2] << endl;
1129 TGeoBBox* hZone =
new TGeoBBox(
"hotZone", hzone[0], hzone[1], wxyzMain[2]);
1130 hotVol =
new TGeoVolume(
"Sensor_hot", hZone);
1132 if (tr[0] > 0 && tr[1] > 0) {
1133 dxyzHot[0] = -wxyzMain[0] + hzone[0];
1134 dxyzHot[1] = -wxyzMain[1] + hzone[1];
1135 }
else if (tr[0] > 0 && tr[1] < 0) {
1136 dxyzHot[0] = -wxyzMain[0] + hzone[0];
1137 dxyzHot[1] = -wxyzMain[1] + hzone[1];
1138 }
else if (tr[0] < 0 && tr[1] < 0) {
1139 dxyzHot[0] = -wxyzMain[0] + hzone[0];
1140 dxyzHot[1] = -wxyzMain[1] + hzone[1];
1141 }
else if (tr[0] < 0 && tr[1] > 0) {
1142 dxyzHot[0] = -wxyzMain[0] + hzone[0];
1143 dxyzHot[1] = -wxyzMain[1] + hzone[1];
1148 transName += iModule;
R__EXTERN TGeoManager * gGeoManager
char * Form(const char *fmt,...)
R__EXTERN TSystem * gSystem
Double_t GetModuleThickness()
BmnGemStripLayer & GetStripLayer(Int_t num)
Double_t GetZPositionRegistered()
BmnGemStripModule * GetModule(Int_t module_num)
Double_t GetZPositionRegistered()
Double_t GetModuleThickness()
BmnSiliconLayer & GetStripLayer(Int_t num)
BmnSiliconModule * GetModule(Int_t module_num)
Double_t GetZPositionRegistered()
BmnVSPLayer & GetStripLayer(Int_t num)
Double_t GetModuleThickness()
BmnVSPModule * GetModule(Int_t module_num)
CbmStsStationDigiPar * GetStation(Int_t iStation)
Accessor to station parameters (by index).
Int_t GetNStations()
Accessor to number of stations.
void Print(Bool_t kLong=kFALSE)
Screen output.
static CbmStsDigiScheme * Instance(int version=1)
CbmStsSensor * GetSensor(Int_t stationNr, Int_t sectorNr, Int_t sensorNr)
Sector by number.
Int_t SetSensorsCbm(Int_t moduleNr, Int_t statNr, CbmStsStation *station, CbmStsStationDigiPar *stationPar)
Bool_t InitNew(CbmGeoStsPar *geoPar, CbmStsDigiPar *digiPar)
New init method (from V12a on).
static CbmStsDigiScheme * fgInstance
BmnGemStripStationSet * GemStationSet
std::map< TString, CbmStsSensor * > fSensorByName
Int_t fNSensors
Total number of sectors.
Bool_t fIsNewGeometry
Total number of channels.
virtual ~CbmStsDigiScheme()
Destructor.
Bool_t Init()
Initialisation.
TString GetCurrentPath()
Construct full path to a node.
std::map< TString, Int_t > fDetIdByName
Map from number to station.
std::map< Int_t, CbmStsStation * > fStationMap
New geometry ( v12 or later ).
Bool_t InitNewNew(CbmGeoStsPar *geoPar, CbmStsDigiPar *digiPar)
Int_t fNChannels
Total number of sensors.
CbmStsSensor * GetSensorByName(TString sensorName)
void Clear()
Clear digitisation scheme.
void Reset()
Reset eventwise counters.
CbmStsStation * GetStationByNr(Int_t stationNr)
Station by index.
Int_t AddHotZone(Int_t moduleNr, Int_t statNr, CbmStsStation *station, CbmStsStationDigiPar *stationPar)
CbmStsSector * GetSector(Int_t stationNr, Int_t sectorNr)
Station by number.
CbmStsDigiScheme()
Constructor.
Int_t GetNStations()
Accessors.
CbmStsStation * GetStation(Int_t iStation)
BmnSiliconStationSet * SilStationSet
Entire GEM detector.
Int_t GetDetectorIdByName(TString sensorName)
Sensor by number.
CbmStsSector * SetSensor(Int_t moduleNr, Int_t statNr, CbmStsStation *station, CbmStsStationDigiPar *stationPar)
BmnVSPStationSet * fVspStationSet
Entire SILICON detector.
Int_t fNSectors
Array of CbmStsStation.
Int_t GetSectorNr() const
Accessors.
CbmStsSensorDigiPar * GetSensor(Int_t iSensor)
void AddSensor(CbmStsSensorDigiPar *sensorPar)
Int_t GetNSensors() const
Int_t GetSensorNr() const
Accessors.
Double_t GetRotation() const
Double_t GetStereoB() const
Double_t GetStereoF() const
CbmStsSectorDigiPar * GetSector(Int_t iSector)
Int_t GetStationNr()
Accessors.
virtual void Print(Bool_t kLong)
Output to screen.
Int_t GetNSectors() const
void AddSector(CbmStsSectorDigiPar *sectorPar)
Add one sector to the array.
void Reset()
Reset all eventwise counters.
virtual Double_t GetDX() const
virtual Double_t GetDZ() const
virtual Double_t GetDY() const
virtual const Double_t * GetTranslation() const=0
virtual void RegisterYourself()
TGeoVolume * GetVolume() const
Int_t GetNdaughters() const
TGeoNode * GetDaughter(Int_t ind) const
virtual TGeoMatrix * GetMatrix() const=0
TGeoMedium * GetMedium() const
virtual TGeoNode * AddNode(TGeoVolume *vol, Int_t copy_no, TGeoMatrix *mat=nullptr, Option_t *option="")
virtual void SetMedium(TGeoMedium *medium)
TGeoShape * GetShape() const
const char * GetName() const override
const char * Data() const
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Double_t Max(Double_t a, Double_t b)