Go to the documentation of this file.
4 #include "TClonesArray.h"
8 #include "TGeoManager.h"
28 #include "CbmTofHit.h"
38 #include <boost/assign/list_of.hpp>
45 using boost::assign::list_of;
50 : FairTask(
"CbmPsdMCbmQaReal")
58 , fOutputDir(
"result") {}
61 cout <<
"CbmPsdMCbmQaReal::Init" << endl;
63 FairRootManager* ioman = FairRootManager::Instance();
64 if (
nullptr == ioman) {
65 Fatal(
"CbmPsdMCbmQaReal::Init",
"RootManager not instantised!");
72 Fatal(
"CbmPsdMCbmQaReal::Init",
"No Psd Digis!");
75 Fatal(
"CbmPsdMCbmQaReal::Init",
"No Tof Digis!");
78 fPsdHits = (TClonesArray*) ioman->GetObject(
"PsdHit");
79 if (
nullptr ==
fPsdHits) { Fatal(
"CbmPsdMCbmQaReal::Init",
"No Psd Hits!"); }
81 fTofHits = (TClonesArray*) ioman->GetObject(
"TofHit");
82 if (
nullptr ==
fTofHits) { Fatal(
"CbmPsdMCbmQaReal::Init",
"No Tof Hits!"); }
84 fTofTracks = (TClonesArray*) ioman->GetObject(
"TofTracks");
86 Fatal(
"CbmPsdMCbmQaReal::Init",
"No Tof Tracks!");
92 fCbmEvent = (TClonesArray*) ioman->GetObject(
"CbmEvent");
93 if (
nullptr ==
fCbmEvent) { Fatal(
"CbmPsdMCbmQaReal::Init",
"No Event!"); }
103 fHM->
Create1<TH1D>(
"fhNofEntries",
"fhNofEntries; Counts", 1, 0.5, 1.5);
104 fHM->
Create1<TH1D>(
"fhNofCbmEvents",
"fhNofCbmEvents;Counts", 1, 0.5, 1.5);
107 "fhHitsInTimeslice",
"fhHitsInTimeslice;Timeslice;#Hits", 200, 1, 200);
110 fHM->
Create1<TH1D>(
"fhNofPsdDigisInTimeslice",
111 "fhNofPsdDigisInTimeslice;# PSD digis / timeslice;Counts",
116 "fhNofPsdHitsInTimeslice;# PSD hits / timeslice;Counts",
123 "fhPsdHitPos;PSD module id [];PSD section id [];Counts",
131 "fhPsdHitsTimeLog",
"fhPsdHitsTimeLog;Time [ns];Counts", 400, 0., 0.);
136 "fhPsdDigisTimeLog",
"fhNofPsdDigisTimeLog;Time [ns];Counts", 400, 0., 0.);
138 "fhTofDigisTimeLog",
"fhTofDigisTimeLog;Time [ns];Counts", 400, 0., 0.);
140 "fhStsDigisTimeLog",
"fhStsDigisTimeLog;Time [ns];Counts", 400, 0., 0.);
142 "fhT0DigisTimeLog",
"fhT0DigisTimeLog;Time [ns];Counts", 400, 0., 0.);
146 "fhPsdDigisEdep",
"fhPsdDigisEdep;Edep [adc counts];Counts", 500, 0, 50000);
148 "fhPsdHitEdep",
"fhPsdHitEdep;Edep [adc counts];Counts", 500, 0, 50000);
150 "fhPsdEdepInEvent; Edep [adc counts]; Counts",
157 "fhTofTrackMultPsdEdep",
158 "fhTofTrackMultPsdEdep;PSD Edep [adc counts];Tof track Mult [];Counts",
166 "fhTofHitMultPsdEdep",
167 "fhTofHitMultPsdEdep;PSD Edep [adc counts];Tof hit Mult [];Counts",
178 "fhTofXYZ;Tof Hit X [cm];TofHit Z [cm];Tof Hit Y [cm];Counts",
189 "fhTofHitsZ",
"fhTofHitsZ;Z [cm];Counts", 350, -0.5, 349.5);
191 "fhTofHitsXZ;Z [cm];X [cm];Counts",
201 "fhTofTracksPerEvent;NofTracks/Event;Counts",
206 "fhTofTracksXY;X[cm];Y[cm];NofTracks/cm^2",
218 fHM->
H1(
"fhNofEntries")->Fill(1);
219 cout <<
"CbmPsdMCbmQaReal, entry No. " <<
fEntryNum << endl;
234 fHM->
H1(
"fhPsdHitsTimeLog")->GetXaxis()->SetLimits(minTime, minTime + dT);
235 fHM->
H1(
"fhPsdDigisTimeLog")
237 ->SetLimits(minTime, minTime + dT);
238 fHM->
H1(
"fhTofDigisTimeLog")
240 ->SetLimits(minTime, minTime + dT);
241 fHM->
H1(
"fhStsDigisTimeLog")
243 ->SetLimits(minTime, minTime + dT);
244 fHM->
H1(
"fhT0DigisTimeLog")->GetXaxis()->SetLimits(minTime, minTime + dT);
254 fHM->
H1(
"fhNofPsdDigisInTimeslice")->Fill(nofPsdDigis);
255 for (
int i = 0;
i < nofPsdDigis;
i++) {
262 for (
int i = 0;
i < nofTofDigis;
i++) {
269 for (
int i = 0;
i < nofStsDigis;
i++) {
284 int nofPsdHits =
fPsdHits->GetEntries();
285 fHM->
H1(
"fhNofPsdHitsInTimeslice")->Fill(nofPsdHits);
287 for (
int iH = 0; iH < nofPsdHits; iH++) {
294 auto fNCbmEvent =
fCbmEvent->GetEntriesFast();
296 for (
int i = 0;
i < fNCbmEvent;
i++) {
297 fHM->
H1(
"fhNofCbmEvents")->Fill(1);
299 std::vector<int> evPsdHitIndx;
316 Double_t PsdEdepInEvent = 0.;
317 for (
int j = 0; j < nofPsdHitsInEvent; j++) {
319 evPsdHitIndx.push_back(iPsdHit);
322 PsdEdepInEvent += psdHit->
GetEdep();
324 fHM->
H1(
"fhPsdEdepInEvent")->Fill(PsdEdepInEvent);
325 fHM->
H2(
"fhTofTrackMultPsdEdep")->Fill(PsdEdepInEvent, nofTofTracksInEvent);
326 fHM->
H2(
"fhTofHitMultPsdEdep")->Fill(PsdEdepInEvent, nofTofHitsInEvent);
328 for (
int j = 0; j < nofTofHitsInEvent; j++) {
333 fHM->
H1(
"fhTofHitsZ")->Fill(tofHit->
GetZ());
334 fHM->
H1(
"fhTofHitsXZ")->Fill(tofHit->
GetZ(), tofHit->
GetX());
338 fHM->
H1(
"fhTofTracksPerEvent")->Fill(nofTofTracksInEvent);
339 for (
int j = 0; j < nofTofTracksInEvent; j++) {
344 fHM->
H2(
"fhTofTracksXY")
357 double nofEvents =
fHM->
H1(
"fhNofCbmEvents")->GetEntries();
362 "psd_mcbm_fhNofEntries",
"psd_mcbm_fhNofEntries", 600, 600);
368 "psd_mcbm_fhNofCbmEvents",
"psd_mcbm_fhNofCbmEvents", 600, 600);
380 "psd_mcbm_nofObjectsInTimeslice",
397 "psd_mcbm_DigisTimeLog",
"psd_mcbm_DigisTimeLog", 1200, 1200);
399 fHM->
H1(
"fhTofDigisTimeLog"),
400 fHM->
H1(
"fhT0DigisTimeLog"),
401 fHM->
H1(
"fhPsdDigisTimeLog")},
402 {
"STS",
"TOF",
"T0",
"PSD"},
410 gPad->SetLeftMargin(0.1);
411 gPad->SetRightMargin(0.10);
412 fHM->
H1(
"fhStsDigisTimeLog")->GetYaxis()->SetTitleOffset(0.7);
413 fHM->
H1(
"fhStsDigisTimeLog")->SetMinimum(0.9);
418 "psd_mcbm_fhPsdDigisEdep",
"psd_mcbm_fhPsdDigisEdep", 600, 600);
424 "psd_mcbm_fhPsdHitEdep",
"psd_mcbm_fhPsdHitEdep", 600, 600);
430 "psd_mcbm_fhPsdEdepInEvent",
"psd_mcbm_fhPsdEdepInEvent", 600, 600);
436 "psd_mcbm_fhTofTrackMultPsdEdep",
444 "psd_mcbm_fhTofHitMultPsdEdep",
462 fHM->
H3(
"fhTofXYZ")->Draw();
466 TCanvas* c =
fHM->
CreateCanvas(
"TofTracksXY",
"TofTracksXY", 1200, 800);
478 std::cout <<
"Drawing Hists...";
480 std::cout <<
"DONE!" << std::endl;
484 std::cout <<
"Canvas saved to Images!" << std::endl;
488 TDirectory* oldir = gDirectory;
489 std::string s =
fOutputDir +
"/RecoHists.root";
490 TFile* outFile =
new TFile(s.c_str(),
"RECREATE");
491 if (outFile->IsOpen()) {
493 std::cout <<
"Written to Root-file \"" << s <<
"\" ...";
495 std::cout <<
"Done!" << std::endl;
497 gDirectory->cd(oldir->GetPath());
503 const string& outputDir) {
506 if (
fHM !=
nullptr)
delete fHM;
509 TFile* file =
new TFile(fileName.c_str());
virtual InitStatus Init()
Inherited from FairTask.
UInt_t GetIndex(ECbmDataType type, UInt_t iData)
void WriteToFile()
Write all histograms to current opened file.
void ScaleByPattern(const std::string &pattern, Double_t scale)
Scale histograms which name matches specified pattern.
bool fDigiHitsInitialized
void Create3(const std::string &name, const std::string &title, Int_t nofBinsX, Double_t minBinX, Double_t maxBinX, Int_t nofBinsY, Double_t minBinY, Double_t maxBinY, Int_t nofBinsZ, Double_t minBinZ, Double_t maxBinZ)
Helper function for creation of 3-dimensional histograms and profiles. Template argument is a real ob...
void ReadFromFile(TFile *file)
Read histograms from file.
InitStatus Init()
Initialisation.
void Create2(const std::string &name, const std::string &title, Int_t nofBinsX, Double_t minBinX, Double_t maxBinX, Int_t nofBinsY, Double_t minBinY, Double_t maxBinY)
Helper function for creation of 2-dimensional histograms and profiles. Template argument is a real ob...
CbmDigiManager * fDigiMan
Provides information on attaching a TofHit to a TofTrack.
TH2 * H2(const std::string &name) const
Return pointer to TH2 histogram.
static Int_t GetNofDigis(ECbmModuleId systemId)
CbmPsdMCbmQaReal()
Standard constructor.
@ kTof
Time-of-flight Detector.
Helper functions for drawing 1D and 2D histograms and graphs.
FairTask for matching RECO data to MC.
static Bool_t IsPresent(ECbmModuleId systemId)
Presence of a digi branch.
TH3 * H3(const std::string &name) const
Return pointer to TH3 histogram.
static CbmDigiManager * Instance()
Static instance.
TClonesArray * fTofTracks
void DrawH1(TH1 *hist, HistScale logx, HistScale logy, const string &drawOpt, Int_t color, Int_t lineWidth, Int_t lineStyle, Int_t markerSize, Int_t markerStyle)
void DrawFromFile(const string &fileName, const string &outputDir)
Draw histogram from file.
void DrawHist()
Draw histograms.
const Digi * Get(Int_t index) const
Get a digi object.
Double_t GetTime() const
Inherited from CbmDigi.
void Create1(const std::string &name, const std::string &title, Int_t nofBins, Double_t minBin, Double_t maxBin)
Helper function for creation of 1-dimensional histograms and profiles. Template argument is a real ob...
Double_t GetTime() const
Time.
ClassImp(CbmConverterManager) InitStatus CbmConverterManager
TH1 * H1(const std::string &name) const
Return pointer to TH1 histogram.
Data class for a single-channel message in the STS.
Data class for expanded digital TOF information.
TCanvas * CreateCanvas(const std::string &name, const std::string &title, Int_t width, Int_t height)
Create and draw TCanvas and store pointer to it.
void SaveCanvasToImage(const std::string &outputDir, const std::string &options="png,eps")
Save all stored canvases to images.
Double_t GetSectionID() const
Index of PSD section @value section index [].
TClonesArray * fTofTracks
void InitHistograms()
Initialize histograms.
Double_t GetFitX(Double_t Z)
Double_t GetFitY(Double_t Z)
Int_t GetModuleID() const
Index of PSD module @value module index [].
Class characterising one event by a collection of links (indices) to data objects,...
data class for hit information in PSD
@ kPsd
Projectile spectator detector.
void DrawH2(TH2 *hist, HistScale logx, HistScale logy, HistScale logz, const string &drawOpt)
Data class for PSD digital information.
virtual void Exec(Option_t *option)
Inherited from FairTask.
Double_t GetEdep() const
Energy deposited in PSD section @value Energy [a.u.].
friend F32vec4 max(const F32vec4 &a, const F32vec4 &b)
@ kSts
Silicon Tracking System.
virtual void Finish()
Inherited from FairTask.
Double_t GetEdep() const
Energy deposit.