15#include "CbmStsPoint.h"
19#include "FairRootManager.h"
20#include "FairRunAna.h"
21#include "FairRuntimeDb.h"
87 :
FairTask(
"STSFindHitsQa", iVerbose)
130 :
FairTask(
"STSFindHitsQa", iVerbose)
236 cerr <<
"-E- " << fName <<
"::Exec: No digi scheme!" << endl;
244 for (
Int_t idigi = 0; idigi < nofStsDigis; idigi++) {
253 Int_t hitStationLimits[2][100];
256 hitStationLimits[0][ist] = -1;
257 hitStationLimits[1][ist] = -1;
262 for (
Int_t ihit = 0; ihit < nofStsHits; ihit++) {
266 if (hitStationLimits[0][stsHit->
GetStationNr() - 1] == -1) {
270 if (hitStationLimits[1][stsHitBack->
GetStationNr() - 1] == -1) {
271 hitStationLimits[1][stsHitBack->
GetStationNr() - 1] = nofStsHits - ihit;
280 for (
Int_t iside = 0; iside < 2; iside++) {
281 for (
Int_t iChip = 0; iChip < 8; iChip++) {
283 cout <<
" St " << istat + 1 <<
" sect " << isect + 1 <<
" nofsens " << sector->
GetNSensors()
284 <<
" sectX " << sensor->
GetX0() <<
" sectY " << sensor->
GetY0() <<
" side " << iside
285 <<
" chip " << iChip + 1 <<
" fNofDigisPChip "
304 for (
Int_t ipnt = 0; ipnt < nofStsPoints; ipnt++) {
326 Int_t trackId = stsPoint->GetTrackID();
345 Int_t startHit = hitStationLimits[0][stationNr - 1];
346 Int_t finalHit = hitStationLimits[1][stationNr - 1];
362 if (startHit == -1 && finalHit == -1)
365 for (
Int_t ihit = startHit; ihit < finalHit; ihit++) {
367 if ((
TMath::Abs(stsHit->GetX() - stsPoint->
GetX(stsHit->GetZ())) < .01)
368 && (
TMath::Abs(stsHit->GetY() - stsPoint->
GetY(stsHit->GetZ())) < .04))
371 stsHit->GetY() - stsPoint->
GetY(stsHit->GetZ()));
373 stsHit->GetY() - stsPoint->
GetY(stsHit->GetZ()));
374 fhHitPointPull->Fill((stsHit->GetX() - stsPoint->
GetX(stsHit->GetZ())) / stsHit->GetDx(),
375 (stsHit->GetY() - stsPoint->
GetY(stsHit->GetZ())) / stsHit->GetDy());
377 if (stsPoint->
GetY(stsHit->GetZ()) > 0.)
379 stsHit->GetY() - stsPoint->
GetY(stsHit->GetZ()));
380 if (stsPoint->
GetY(stsHit->GetZ()) < 0.)
382 stsHit->GetY() - stsPoint->
GetY(stsHit->GetZ()));
385 if ((
TMath::Abs(stsHit->GetX() - stsPoint->
GetX(stsHit->GetZ())) < .01)
386 && (
TMath::Abs(stsHit->GetY() - stsPoint->
GetY(stsHit->GetZ())) < .04))
405 fhPoints[stationNr - 1]->Fill(stsPoint->
GetX(stsPoint->GetZ()), stsPoint->
GetY(stsPoint->GetZ()));
407 if (trackPdg < 10000 && motherId >= 0) {
412 if (trackPdg < 10000 && motherId < 0) {
423 fhRecoPoints[stationNr - 1]->Fill(stsPoint->
GetX(stsPoint->GetZ()), stsPoint->
GetY(stsPoint->GetZ()));
425 if (trackPdg < 10000 && motherId >= 0) {
430 if (trackPdg < 10000 && motherId < 0) {
436 for (
Int_t ang = 0; ang < 400; ang++) {
440 for (
Int_t momentum = 0; momentum < 50; momentum++) {
446 TLegend* brp =
new TLegend(0.1, 0.1, 0.9, 0.9,
"STS hit finding");
462 TLine* oneLine =
new TLine(0.0, 1.0, 10.0, 1.0);
473 for (
Int_t ist = 0; ist < 8; ist++) {
476 fitX[ist] =
new TF1(
Form(
"fitX%i", ist + 1),
"gaus", -0.02, 0.02);
477 fitY[ist] =
new TF1(
Form(
"fitY%i", ist + 1),
"gaus", -0.02, 0.02);
480 projX[ist]->
Fit(fitX[ist],
"QN",
"", -0.02, 0.02);
481 projY[ist]->
Fit(fitY[ist],
"QN",
"", -0.02, 0.02);
482 resolution[0][ist] = 10000. * fitX[ist]->
GetParameter(2);
483 resolution[1][ist] = 10000. * fitY[ist]->
GetParameter(2);
494 fitXPull =
new TF1(
"fitXPull",
"gaus", -2, 2);
495 fitYPull =
new TF1(
"fitYPull",
"gaus", -2, 2);
498 projXPull->
Fit(fitXPull,
"QN",
"", -2, 2);
499 projYPull->
Fit(fitYPull,
"QN",
"", -2, 2);
518 projY[0]->
Draw(
"same");
524 legend1->
AddEntry(projX[0],
Form(
"X,#sigma=%3.2f#mum", resolution[0][0]),
"l");
525 legend1->
AddEntry(projY[0],
Form(
"Y,#sigma=%3.2f#mum", resolution[1][0]),
"l");
536 projYPull->
Draw(
"same");
542 legend2a->
AddEntry(projXPull,
Form(
"X,#sigma=%3.2f#mum", resolutionPull[0]),
"l");
543 legend2a->
AddEntry(projYPull,
Form(
"Y,#sigma=%3.2f#mum", resolutionPull[1]),
"l");
586 printoutPave->
AddText(
Form(
"%3.0f points prim, %3.0f reco prim",
592 printoutPave->
AddText(
Form(
"Hit Finding Efficiency: %3.2f prim, %3.2f sec",
603 printoutPave->
Draw();
609 cout <<
"---------- StsFindHitsQa : Event " <<
fNEvents + 1 <<
" summary ------------" << endl;
610 cout <<
"-----------------------------------------------------------" << endl;
613 cout <<
"\r+ " << setw(15) << left << fName <<
": event " <<
fNEvents + 1 <<
" " << setprecision(4) << setw(8)
614 << fixed << right <<
fTimer.RealTime() <<
"s." << endl;
644 new TH2F(
Form(
"hHitPointCorrelation"),
Form(
"Hit vs point correlation "), 500, -.1, .1, 500, -.1, .1);
645 fhEffMom =
new TH2F(
"hEffMom",
"hEffMom", 500, 0, 25, 100, 0, 1);
646 fhEffIncAng =
new TH2F(
"hEffIncAng",
"hEffIncAng", 100, 0, 100, 100, 0, 1);
647 fhEffPdgSec =
new TH2F(
"hEffPdgSec",
"hEffPdgSec", 350, -1000, 2500, 10, 0, 1);
648 fhEffPdgPrim =
new TH2F(
"hEffPdgPrim",
"hEffPdgPrim", 350, -1000, 2500, 10, 0, 1);
649 fhHitPointPull =
new TH2F(
"hHitPointPull",
"Hit vs sigma at station %i", 500, -3., 3., 500, -3., 3.);
660 new TH2F(
Form(
"hHitPointCorrelation%i", ist + 1),
Form(
"Hit vs point correlation at station %i", ist + 1),
661 500, -.1, .1, 500, -.1, .1);
668 new TH2F(
Form(
"hHitPointCorrelationU%i", ist + 1),
Form(
"Hit vs point correlation at station %i", ist + 1),
669 500, -.1, .1, 500, -.1, .1);
671 new TH2F(
Form(
"hHitPointCorrelationB%i", ist + 1),
Form(
"Hit vs point correlation at station %i", ist + 1),
672 500, -.1, .1, 500, -.1, .1);
676 fhPoints[ist] =
new TH2F(
Form(
"hPoints%i", ist + 1),
Form(
"Points on station %i", ist + 1), 100, -100., 100.,
679 new TH2F(
Form(
"hRecoPoints%i", ist + 1),
Form(
"Reconstructed points on station %i", ist + 1), 100, -100.,
680 100., 100, -100., 100.);
686 binningNofHits[0] = -0.5;
687 for (
Int_t itemp = 0; itemp < 100; itemp++) {
688 binningNofHits[itemp + 1] = 0.5 + (
Double_t)itemp;
689 binningNofHits[itemp + 101] = 101.5 + 2. * (
Double_t)itemp;
690 binningNofHits[itemp + 201] = 302.5 + 3. * (
Double_t)itemp;
691 binningNofHits[itemp + 301] = 602.5 + 3. * (
Double_t)itemp;
692 binningNofHits[itemp + 401] = 902.5 + 3. * (
Double_t)itemp;
700 20, -100., 100., 20, -100., 100., 100, 0, 0.01);
702 new TH3F(
Form(
"hIncAngleSt%d", istat + 1),
Form(
"Incident Angle on station %d;X;Y;Angle", istat + 1), 100,
703 -50, 50, 100, -40, 40, 20, 0, 100.);
712 Form(
"hNofHitsSt%dSect%dSens%d", istat + 1, isect + 1, isens + 1),
713 Form(
"Number of hits in sector %d, sensor %d of station %d", isect + 1, isens + 1, istat + 1), 500,
728 while (
TH1* histo = ((
TH1*)next()))
732 while (
TH1* histo = ((
TH1*)next0()))
743 FairRunAna* run = FairRunAna::Instance();
745 Fatal(
"SetParContainers",
"No analysis run");
747 FairRuntimeDb* db = run->GetRuntimeDb();
749 Fatal(
"SetParContainers",
"No runtime database");
764 FairRootManager* ioman = FairRootManager::Instance();
766 Fatal(
"Init",
"No FairRootManager");
771 cout <<
"-E- " << GetName() <<
"::Init: No MCTrack array!" << endl;
784 cout <<
"-E- " << GetName() <<
"::Init: No StsHit array!" << endl;
791 cout <<
"-E- " << GetName() <<
"::Init: No StsDigi array!" << endl;
798 cout <<
"-w- " << GetName() <<
"::Init: No StsCluster array!" << endl;
821 for (
Int_t iang = 0; iang < 400; iang++) {
825 for (
Int_t ipdg = -10000; ipdg < 10000; ipdg++) {
835 recoCanvas =
new TCanvas(
"StsRecoCanvas",
"Sts reconstruction", 10, 10, 600, 900);
838 recoPad[0] =
new TPad(
"titlePad",
"Title pad", 0.00, 0.90, 1.00, 1.00);
839 recoPad[1] =
new TPad(
"efficiencyPad",
"Efficiency pad", 0.00, 0.60, 0.40, 0.90);
840 recoPad[3] =
new TPad(
"hitVspoint1Pad",
"Hit vs point on st.1 pad", 0.40, 0.65, 0.70, 0.90);
841 recoPad[4] =
new TPad(
"hitPullst1",
"Hit vs sigma on st.1 pad", 0.70, 0.65, 1.00, 0.90);
842 recoPad[5] =
new TPad(
"hitVspntXY1Pad",
"Hit vs point XY on st.1 pad", 0.40, 0.40, 0.70, 0.65);
843 recoPad[6] =
new TPad(
"hitVssigmaXY6Pad",
"Hit vs sigma XY on st.1 pad", 0.70, 0.40, 1.00, 0.65);
844 recoPad[2] =
new TPad(
"Reco Points st1",
"Reco Points st1", 0.00, 0.20, 0.33, 0.40);
845 recoPad[7] =
new TPad(
"Reco Points st2",
"Reco Points st2", 0.33, 0.20, 0.66, 0.40);
846 recoPad[8] =
new TPad(
"Reco Points st3",
"Reco Points st3", 0.66, 0.20, 1.00, 0.40);
847 recoPad[9] =
new TPad(
"Reco Points st5",
"Reco Points st5", 0.00, 0.00, 0.33, 0.20);
848 recoPad[10] =
new TPad(
"Reco Points st6",
"Reco Points st6", 0.33, 0.00, 0.66, 0.20);
849 recoPad[11] =
new TPad(
"Reco Points st8",
"Reco Points st8", 0.66, 0.00, 1.00, 0.20);
850 recoPad[12] =
new TPad(
"printoutPad",
"Print information pad", 0.00, 0.40, 0.40, 0.60);
852 for (
Int_t ipad = 0; ipad < 13; ipad++) {
853 recoPad[ipad]->SetFillColor(0);
854 recoPad[ipad]->SetBorderMode(0);
859 if (fVerbose == 1 || fVerbose == 2)
861 else if (fVerbose > 2)
863 cout <<
"-I- " << fName <<
"::Init: " <<
"STS digitisation scheme succesfully initialised" << endl;
865 <<
", Channels: " <<
fDigiScheme->GetNChannels() << endl;
883 if (fVerbose == 1 || fVerbose == 2)
885 else if (fVerbose > 2)
887 cout <<
"-I- " << fName <<
"::Init: "
888 <<
"STS digitisation scheme succesfully reinitialised" << endl;
890 <<
", Channels: " <<
fDigiScheme->GetNChannels() << endl;
917 HFE_point += (
fNofPoints[istat][isect][isens]);
922 for (
Int_t iPdg = -10000; iPdg < 10000; iPdg++) {
928 cout <<
"============================================================" << endl;
929 cout <<
"===== " << fName <<
": Run summary " << endl;
930 cout <<
"===== Hit finding efficiency = " << (((
Float_t)(HFE_reco)) / ((
Float_t)(HFE_point))) * 100. <<
"%" << endl;
931 cout <<
"============================================================" << endl;
936 while (
TH1* histo = ((
TH1*)next()))
943 while (
TH1* histo = ((
TH1*)nextO()))
void Fatal(const char *location, const char *msgfmt,...)
R__EXTERN TGeoManager * gGeoManager
char * Form(const char *fmt,...)
void GetMomentum(TVector3 &momentum) const
Int_t GetMotherId() const
void GetStartVertex(TVector3 &vertex) const
Int_t GetPdgCode() const
Accessors.
static CbmStsDigiScheme * Instance(int version=1)
Int_t GetSide() const
Side ( 0 = front, 1 = back ).
Int_t GetSectorNr() const
Sector number.
Int_t GetChannelNr() const
Channel number.
Int_t GetStationNr() const
Station number.
Int_t fNofDigisPChip[20][300][2][20]
Int_t fNofPointsMom[1000]
Int_t fNofRecoPdgSec[20000]
virtual void SetParContainers()
Get parameter containers.
Double_t fTime1
Number of events with success.
Int_t fNofPoints[20][300][3]
virtual void Exec(Option_t *opt)
Execution.
TClonesArray * fStsClusters
CbmStsFindHitsQa()
Default constructor.
Int_t fNofPointsPdgSec[20000]
Int_t fNofRecoPointsMomSum
Int_t fNofRecoPdgPrim[20000]
Int_t fNofRecoPointsMom[1000]
Int_t fNofRecoPoints[20][300][3]
TH2F * fhHitPointCorrelationU[100]
virtual InitStatus Init()
Intialisation.
virtual InitStatus ReInit()
Reinitialisation.
CbmGeoStsPar * fGeoPar
Pointers to data arrays.
virtual void Finish()
Virtual method Finish.
TList * fHistoList
List of histograms.
TClonesArray * fStsPoints
TH2F * fhHitPointCorrelation[100]
TH1F * fhNofHits[20][300][3]
Int_t fNofHits[20][300][3]
Int_t fNofRecoPointsIncAng[1000]
CbmStsDigiScheme * fDigiScheme
Digitisation parameters.
CbmStsDigiPar * fDigiPar
Geometry parameters.
virtual ~CbmStsFindHitsQa()
Destructor.
TH1F * fhHitFindingEfficiency
Int_t fNofPointsPdgPrim[20000]
Int_t fNofPointsIncAng[1000]
void Reset()
Reset histograms and counters.
void CreateHistos()
Create histograms.
TClonesArray * fMCTracks
Digitisation scheme.
TH2F * fhHitPointCorrelationB[100]
Int_t GetSensorNr() const
virtual Int_t GetStationNr() const
Int_t GetSectorNr() const
Double_t GetY(Double_t z) const
Double_t GetX(Double_t z) const
Point coordinates at given z from linear extrapolation.
Double_t GetXIn() const
Accessors.
CbmStsSensor * GetSensor(Int_t iSensor)
Int_t GetNSensors() const
Int_t GetSectorNr() const
Int_t GetStationNr() const
Int_t GetSensorNr() const
Int_t GetNSectors() const
CbmStsSector * GetSector(Int_t iSector)
virtual void SetFillColor(Color_t fcolor)
virtual void SetLineStyle(Style_t lstyle)
virtual void SetLineWidth(Width_t lwidth)
virtual void SetLineColor(Color_t lcolor)
virtual void SetTextAlign(Short_t align=11)
virtual void SetTextColor(Color_t tcolor=1)
virtual void SetTextSize(Float_t tsize=1)
virtual Double_t GetParameter(const TString &name) const
virtual void SetXTitle(const char *title)
virtual TFitResultPtr Fit(const char *formula, Option_t *option="", Option_t *goption="", Double_t xmin=0, Double_t xmax=0)
void Draw(Option_t *option="") override
virtual void SetAxisRange(Double_t xmin, Double_t xmax, Option_t *axis="X")
void Draw(Option_t *option="") override
TLegendEntry * AddEntry(const char *name, const char *label="", Option_t *option="lpf")
virtual void Draw(Option_t *option="")
virtual TText * AddText(const char *label)
void Draw(Option_t *option="") override
virtual void SetBorderSize(Int_t bordersize=4)
Double_t ATan2(Double_t y, Double_t x)