14#include "FairGeoNode.h"
16#include "FairGeoTransform.h"
17#include "FairGeoVector.h"
18#include "FairMCPoint.h"
19#include "FairRootManager.h"
20#include "FairRunAna.h"
21#include "FairRuntimeDb.h"
40using std::setprecision;
70 :
FairTask(
"STS Simulation QA", iVerbose)
110 FairRunAna* run = FairRunAna::Instance();
112 cout <<
"-E- " << GetName() <<
"::SetParContainers: No FairRunAna!" << endl;
117 FairRuntimeDb* runDb = run->GetRuntimeDb();
119 cout <<
"-E- " << GetName() <<
"::SetParContainers: No runtime database!" << endl;
126 cout <<
"-E- " << GetName() <<
"::SetParContainers: "
127 <<
"No passive geometry parameters!" << endl;
134 cout <<
"-E- " << GetName() <<
"::SetParContainers: "
135 <<
"No Sts geometry parameters!" << endl;
145 cout <<
"===========================================================" << endl;
147 cout << GetName() <<
": Initialising..." << endl;
150 FairRootManager* ioman = FairRootManager::Instance();
152 cout <<
"-E- " << GetName() <<
"::Init: "
153 <<
"RootManager not instantised!" << endl;
160 cout <<
"-E- " << GetName() <<
"::Init: No MCTrack array!" << endl;
173 if (geoStatus != kSUCCESS) {
174 cout <<
"-E- " << GetName() <<
"::Init: Error in reading geometry!" << endl;
183 fOnlinePad[0] =
new TPad(
"titlePad",
"Title pad", 0.00, 0.90, 1.00, 1.00);
184 fOnlinePad[1] =
new TPad(
"momentumPad",
"Momentum pad", 0.00, 0.35, 0.50, 0.90);
185 fOnlinePad[2] =
new TPad(
"printoutPad",
"Print information pad ", 0.10, 0.10, 0.35, 0.35);
186 fOnlinePad[3] =
new TPad(
"pointPad",
"Points per track pad", 0.50, 0.50, 1.00, 0.90);
187 fOnlinePad[4] =
new TPad(
"stationPad1",
"Points on 1st station pad", 0.50, 0.25, 0.75, 0.50);
188 fOnlinePad[5] =
new TPad(
"stationPad2",
"Points on 3rd station pad", 0.75, 0.25, 1.00, 0.50);
189 fOnlinePad[6] =
new TPad(
"stationPad3",
"Points on 5th station pad", 0.50, 0.00, 0.75, 0.25);
190 fOnlinePad[7] =
new TPad(
"stationPad4",
"Points on 7th station pad", 0.75, 0.00, 1.00, 0.25);
192 for (
Int_t ipad = 0; ipad < 8; ipad++) {
199 TLegend* brp =
new TLegend(0.1, 0.1, 0.9, 0.9,
"Online Sts simulation");
212 cout <<
" Number of Sts stations : " <<
fNStations << endl;
214 cout <<
" ***** Task is ACTIVE *****" << endl;
215 cout <<
"===========================================================" << endl << endl;
225 cout <<
"===========================================================" << endl;
227 cout << GetName() <<
": Reinitialising..." << endl;
231 if (geoStatus != kSUCCESS) {
232 cout <<
"-E- " << GetName() <<
"::ReInit: Error in reading geometry!" << endl;
237 cout <<
" Number of Sts stations : " <<
fNStations << endl;
239 cout <<
" ***** Task is ACTIVE *****" << endl;
240 cout <<
"===========================================================" << endl << endl;
254 for (
Int_t itr = 0; itr < nofMCTracks; itr++) {
259 if ((pdgCode == 10010020) || (pdgCode == 10010030) || (pdgCode == 50000050) || (pdgCode == 50010051)
260 || (pdgCode == 10020040))
278 if (stsPoints > 0 && vertexZ <= 100) {
285 if (stsPoints > 3 && vertexZ <= 100) {
295 for (
Int_t ipnt = 0; ipnt < nofSTSPoints; ipnt++) {
326 printoutPave->
AddText(
Form(
"tracks/event = %3.2f", tracksPerEvent));
327 printoutPave->
AddText(
Form(
"points/event = %3.2f", pointsPerEvent));
329 printoutPave->
Draw();
358 cout << endl << endl;
359 cout <<
"=======================================================" << endl;
360 cout <<
"===== StsSimulationQa: " << endl;
361 cout <<
"===== \rEvent #" <<
fNEvents + 1 << endl;
362 cout <<
"===== " << setprecision(6) << tracksPerEvent <<
" tracks/event" << endl;
363 cout <<
"===== " << setprecision(7) << pointsPerEvent <<
" points/event" << endl;
364 cout <<
"=======================================================" << endl;
386 while (
TH1* histo = ((
TH1*)next()))
396 cout <<
"GET GEOMETRY" << endl;
399 cout <<
"-W- " << GetName() <<
"::GetGeometry: No passive geometry!" << endl;
405 cout <<
"-E- " << GetName() <<
"::GetGeometry: No Sts node array" << endl;
416 for (
Int_t ist = 0; ist < tempNofStations; ist++) {
417 FairGeoNode* stsNode = (FairGeoNode*)stsNodes->
At(ist);
419 cout <<
"-W- CbmStsDigiScheme::Init: station#" << ist <<
" not found among sensitive nodes " << endl;
422 geoNodeName = stsNode->GetName();
423 TArrayD* params = stsNode->getParameters();
428 if (geoNodeName.
Contains(stationNames[ikst])) {
429 FairGeoTransform* transform = stsNode->getLabTransform();
430 FairGeoVector translat = transform->getTranslation();
431 FairGeoTransform center = stsNode->getCenterPosition();
432 FairGeoVector centerV = center.getTranslation();
434 (translat.X() + centerV.X() + params->
At(0)) * (translat.X() + centerV.X() + params->
At(0))
435 + (translat.Y() + centerV.Y() + params->
At(1)) * (translat.Y() + centerV.Y() + params->
At(1)));
441 stationKnown =
kTRUE;
450 if (geoNodeName.
Length() == 12)
453 FairGeoTransform* transform = stsNode->getLabTransform();
454 FairGeoVector translat = transform->getTranslation();
455 FairGeoTransform center = stsNode->getCenterPosition();
456 FairGeoVector centerV = center.getTranslation();
458 (translat.X() + centerV.X() + params->
At(0)) * (translat.X() + centerV.X() + params->
At(0))
459 + (translat.Y() + centerV.Y() + params->
At(1)) * (translat.Y() + centerV.Y() + params->
At(1)));
486 fhMomAll =
new TH1F(
"hMomAll",
"Momentum - all in STS", 100, 0, 50);
488 fhMomAll->SetYTitle(
"yield [a.u.]");
489 fhYPtMapAll =
new TH2F(
"hYPtMapAll",
"Rapidity - trans. mom. map - all in STS", 100, -3, 7, 100, 0, 5);
492 fhPdgCodeAll =
new TH1F(
"hPdgCodeAll",
"PDG code - all in STS", 1000, -500, 500);
497 fhMomRec =
new TH1F(
"hMomRec",
"Momentum - rec in STS", 100, 0, 50);
499 fhMomRec->SetYTitle(
"yield [a.u.]");
500 fhYPtMapRec =
new TH2F(
"hYPtMapRec",
"Rapidity - trans. mom. map - rec in STS", 100, -3, 7, 100, 0, 5);
503 fhPdgCodeRec =
new TH1F(
"hPdgCodeRec",
"PDG code - rec in STS", 1000, -500, 500);
508 fhMomStsPoints =
new TH2F(
"hMomStsPoints",
"momentum vs STSPoints per track", 1000, 0, 9, 100, 0, 50);
509 fhStsPointsPosition =
new TH3F(
"hStsPointsPosition",
"STS hits", 100, 0, 100, 100, -50, 50, 100, -50, 50);
524 40 * histSize, -histSize, histSize, 40 * histSize, -histSize, histSize);
Defines unique identifiers (enum) for all BM@N detector systems.
char * Form(const char *fmt,...)
Long64_t GetNPoints(DetectorId detId) const
Accessors to the number of MCPoints in the detectors.
void GetMomentum(TVector3 &momentum) const
void Get4Momentum(TLorentzVector &momentum) const
void GetStartVertex(TVector3 &vertex) const
Int_t GetPdgCode() const
Accessors.
Double_t GetY(Double_t z) const
Double_t GetX(Double_t z) const
Point coordinates at given z from linear extrapolation.
virtual void SetParContainers()
Set parameter containers.
TH3F * fhStsPointsPosition
virtual void Finish()
Finish.
Float_t fStationRadius[10]
TClonesArray * fSTSPoints
virtual ~CbmStsSimulationQa()
Destructor.
FairGeoPassivePar * fPassGeo
Geometry parameters.
InitStatus GetGeometry()
Read the geometry parameters.
TClonesArray * fMCTracks
Pointers to data arrays.
TH1F * fhMomAll
Histograms.
TList * fHistoList
List of histograms.
virtual void Exec(Option_t *opt)
Execution.
virtual InitStatus ReInit()
Reinitialisation.
CbmStsSimulationQa()
Default constructor.
void Reset()
Reset histograms and counters.
Int_t fStationNrFromMcId[10000]
TH2F * fhStationPoints[10]
void CreateHistos()
Create histograms.
virtual InitStatus Init()
Initialisation.
Double_t At(Int_t i) const
virtual void SetFillColor(Color_t fcolor)
virtual void SetTextAlign(Short_t align=11)
virtual void SetTextColor(Color_t tcolor=1)
virtual void SetTextSize(Float_t tsize=1)
void Draw(Option_t *option="") override
Double_t Rapidity() const
Int_t GetEntries() const override
TObject * At(Int_t idx) const override
virtual TText * AddText(const char *label)
void Draw(Option_t *option="") override
virtual void SetBorderSize(Int_t bordersize=4)
const char * Data() const
TString & Remove(EStripType s, char c)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Double_t Sqrt(Double_t x)