Go to the documentation of this file.
4 #include "TClonesArray.h"
8 #include "TGeoManager.h"
30 #include "CbmRichUtil.h"
32 #include "CbmTofHit.h"
43 #include <boost/assign/list_of.hpp>
50 using boost::assign::list_of;
55 : FairTask(
"CbmRichMCbmAerogelAna")
63 , fNofDrawnRichTofEv(0)
65 , fOutputDir(
"result") {}
68 cout <<
"CbmRichMCbmAerogelAna::Init" << endl;
70 FairRootManager* ioman = FairRootManager::Instance();
71 if (
nullptr == ioman) {
72 Fatal(
"CbmRichMCbmQaReal::Init",
"RootManager not instantised!");
79 Fatal(
"CbmRichMCbmQaReal::Init",
"No Rich Digis!");
82 Fatal(
"CbmRichMCbmQaReal::Init",
"No Tof Digis!");
84 fRichHits = (TClonesArray*) ioman->GetObject(
"RichHit");
86 Fatal(
"CbmRichMCbmAerogelAna::Init",
"No Rich Hits!");
89 fRichRings = (TClonesArray*) ioman->GetObject(
"RichRing");
91 Fatal(
"CbmRichMCbmAerogelAna::Init",
"No Rich Rings!");
106 fCbmEvent = (TClonesArray*) ioman->GetObject(
"CbmEvent");
107 if (
nullptr ==
fCbmEvent) { Fatal(
"fTofDigis::Init",
"No Event!"); }
117 fHM->
Create1<TH1D>(
"fhNofEvents",
"fhNofEvents;Entries", 1, 0.5, 1.5);
118 fHM->
Create1<TH1D>(
"fhNofCbmEvents",
"fhNofCbmEvents;Entries", 1, 0.5, 1.5);
120 "fhNofCbmEventsRing",
"fhNofCbmEventsRing;Entries", 1, 0.5, 1.5);
123 "fhHitsInTimeslice",
"fhHitsInTimeslice;Timeslice;#Hits", 200, 1, 200);
127 "fhNofRichDigisInTimeslice",
128 "fhNofRichDigisInTimeslice;# RICH digis / timeslice;Entries",
132 fHM->
Create1<TH1D>(
"fhNofRichHitsInTimeslice",
133 "fhNofRichHitsInTimeslice;# RICH hits / timeslice;Entries",
138 "fhNofRichRingsInTimeslice",
139 "fhNofRichRingsInTimeslice;# RICH rings / timeslice;Entries",
146 "fhRichHitXY;RICH hit X [cm];RICH hit Y [cm];Entries",
154 "fhEventRichHitXY;RICH hit X [cm];RICH hit Y [cm];Entries",
162 "fhEventRichHitX;RICH hit X [cm];Entries",
167 "fhEventRichHitY;RICH hit Y [cm];Entries",
172 "fhRichHitX;RICH hit X [cm];Entries",
177 "fhRichHitY",
"fhRichHitY;RICH hit Y [cm];Entries", 84, -25.2, 25.2);
181 "fhRichDigisToT",
"fhRichDigisToT;ToT [ns];Entries", 601, 9.975, 40.025);
183 "fhRichHitToT",
"fhRichHitToT;ToT [ns];Entries", 601, 9.975, 40.025);
188 "fhRichRingXY;Ring center X [cm];Ring center Y [cm];Entries",
196 "fhRichRingRadius;Ring radius [cm];Entries",
201 "fhNofHitsInRing;# hits in ring;Entries",
209 "fhEventRichRingXY;Ring center X [cm];Ring center Y [cm];Entries",
217 "fhEventRichRingRadius;Ring radius [cm];Entries",
222 "fhEventNofHitsInRing;# hits in ring;Entries",
227 "fhEventNofHitsInRingTop;# hits in ring;Entries",
231 fHM->
Create1<TH1D>(
"fhEventNofHitsInRingBottom",
232 "fhEventNofHitsInRingBottom;# hits in ring;Entries",
238 "fhEventRichHitToT",
"fhRichHitToT;ToT [ns];Entries", 601, 9.975, 40.025);
240 fHM->
Create1<TH1D>(
"fhEventRichRingRadiusTop",
241 "fhEventRichRingRadiusTop;Ring radius [cm];Entries",
245 fHM->
Create1<TH1D>(
"fhEventRichRingRadiusBottom",
246 "fhEventRichRingRadiusBottom;Ring radius [cm];Entries",
252 "fhNofRingsTopBottom",
"fhNofRingsTopBottom;Entries", 2, -0.5, 1.5);
258 fHM->
H1(
"fhNofEvents")->Fill(1);
259 cout <<
"CbmRichMCbmAerogelAna, event No. " <<
fEventNum << endl;
264 fHM->
H1(
"fhRichDigisToT")->Fill(richDigi->
GetToT());
268 int nofRichHits =
fRichHits->GetEntries();
269 fHM->
H1(
"fhNofRichHitsInTimeslice")->Fill(nofRichHits);
271 for (
int iH = 0; iH < nofRichHits; iH++) {
273 fHM->
H2(
"fhRichHitXY")->Fill(richHit->
GetX(), richHit->
GetY());
275 fHM->
H1(
"fhRichHitX")->Fill(richHit->
GetX());
276 fHM->
H1(
"fhRichHitY")->Fill(richHit->
GetY());
282 auto fNCbmEvent =
fCbmEvent->GetEntriesFast();
284 for (
int i = 0;
i < fNCbmEvent;
i++) {
285 fHM->
H1(
"fhNofCbmEvents")->Fill(1);
287 std::vector<int> ringIndx;
288 std::vector<int> evRichHitIndx;
293 evRichHitIndx.push_back(iRichHit);
296 for (
int l = 0; l < nofRichRings; l++) {
299 for (
int m = 0;
m < NofRingHits;
m++) {
300 auto RingHitIndx = ring->
GetHit(
m);
301 if (RingHitIndx == iRichHit) {
303 for (
auto check : ringIndx) {
309 if (used ==
false) ringIndx.push_back(l);
320 if (ringIndx.size() > 0) {
325 fHM->
H1(
"fhEventRichHitToT")->Fill(richHit->
GetToT());
326 fHM->
H2(
"fhEventRichHitXY")->Fill(richHit->
GetX(), richHit->
GetY());
327 fHM->
H1(
"fhEventRichHitX")->Fill(richHit->
GetX());
328 fHM->
H1(
"fhEventRichHitY")->Fill(richHit->
GetY());
336 if (ring ==
nullptr)
continue;
338 fHM->
H2(
"fhEventRichRingXY")
347 fHM->
H1(
"fhNofRingsTopBottom")->Fill(0);
351 fHM->
H1(
"fhNofRingsTopBottom")->Fill(1);
356 fHM->
H1(
"fhNofCbmEventsRing")->Fill(1);
367 for (
int i = 0;
i < nofRichRings;
i++) {
369 if (ring ==
nullptr)
continue;
382 double nofEvents =
fHM->
H1(
"fhNofCbmEvents")->GetEntries();
387 "rich_mcbm_fhNofCbmEvents",
"rich_mcbm_fhNofCbmEvents", 600, 600);
393 "rich_mcbm_fhNofCbmEventsRing",
"rich_mcbm_fhNofCbmEventsRing", 600, 600);
399 "rich_mcbm_fhNofEvents",
"rich_mcbm_fhNofEvents", 600, 600);
405 TCanvas* c =
fHM->
CreateCanvas(
"rich_mcbm_XY",
"rich_mcbm_XY", 1200, 600);
416 "rich_mcbm_XY_inEvent",
"rich_mcbm_XY_inEvent", 1200, 600);
427 "rich_mcbm_X_and_Y_inEvent",
"rich_mcbm_X_and_Y_inEvent", 1200, 600);
437 "rich_mcbm_X_and_Y_inEventWithRing",
479 "rich_mcbm_rings_inEvent",
"rich_mcbm_rings_inEvent", 1200, 600);
489 "rich_Aerogel_Top_Bottom_Hits",
495 unsigned int sumHitsTop = 0;
496 for (
unsigned int i = 1;
i <= 50;
i++) {
498 fHM->
H1(
"fhEventNofHitsInRingTop")->GetBinContent(
i) * (
i - 1);
500 std::cout <<
"Sum Hits Top: " << sumHitsTop << std::endl;
504 unsigned int sumHitsBottom = 0;
505 for (
unsigned int i = 1;
i <= 50;
i++) {
507 fHM->
H1(
"fhEventNofHitsInRingBottom")->GetBinContent(
i) * (
i - 1);
509 std::cout <<
"Sum Hits Bottom: " << sumHitsBottom << std::endl;
514 "rich_Aerogel_Top_Bottom_Radius",
527 "rich_Aerogel_#RingsTopVsBottom",
530 fHM->
H1(
"fhNofRingsTopBottom")->Draw(
"HIST TEXT");
537 std::cout <<
"Drawing Hists...";
539 std::cout <<
"DONE!" << std::endl;
543 std::cout <<
"Canvas saved to Images!" << std::endl;
547 TDirectory* oldir = gDirectory;
548 std::string s =
fOutputDir +
"/RecoHists.root";
549 TFile* outFile =
new TFile(s.c_str(),
"RECREATE");
550 if (outFile->IsOpen()) {
552 std::cout <<
"Written to Root-file \"" << s <<
"\" ...";
554 std::cout <<
"Done!" << std::endl;
556 gDirectory->cd(oldir->GetPath());
562 const string& outputDir) {
565 if (
fHM !=
nullptr)
delete fHM;
568 TFile* file =
new TFile(fileName.c_str());
578 if ((hit->
GetToT() > 23.7) && (hit->
GetToT() < 30.0)) check =
true;
UInt_t GetIndex(ECbmDataType type, UInt_t iData)
Ring finder implementation based on Hough Transform method.
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.
virtual InitStatus Init()
Inherited from FairTask.
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...
TH2 * H2(const std::string &name) const
Return pointer to TH2 histogram.
static Int_t GetNofDigis(ECbmModuleId systemId)
Bool_t cutRadius(CbmRichRing *ring)
@ 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.
static CbmDigiManager * Instance()
Static instance.
virtual void Exec(Option_t *option)
Inherited from FairTask.
void InitHistograms()
Initialize histograms.
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)
UInt_t GetHit(Int_t i) const
const Digi * Get(Int_t index) const
Get a digi object.
Convert internal data classes to cbmroot common data classes.
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...
@ kRich
Ring-Imaging Cherenkov Detector.
ClassImp(CbmConverterManager) InitStatus CbmConverterManager
TClonesArray * fRichRings
TH1 * H1(const std::string &name) const
Return pointer to TH1 histogram.
void DrawFromFile(const string &fileName, const string &outputDir)
Draw histogram from file.
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.
CbmRichMCbmAerogelAna()
Standard constructor.
Class characterising one event by a collection of links (indices) to data objects,...
Float_t GetRadius() const
Float_t GetCenterY() const
CbmDigiManager * fDigiMan
void DrawH2(TH2 *hist, HistScale logx, HistScale logy, HistScale logz, const string &drawOpt)
bool doToT(CbmRichHit *hit)
virtual void Finish()
Inherited from FairTask.
void DrawHist()
Draw histograms.
Float_t GetCenterX() const