17 #include "CbmTofHit.h"
23 #include "FairMCEventHeader.h"
33 #include "FairLogger.h"
34 #include "FairRootManager.h"
35 #include "FairRunAna.h"
36 #include "FairRuntimeDb.h"
39 #include "Riostream.h"
40 #include "TClonesArray.h"
60 : FairTask(
"HadronAnalysis")
74 , fTofPointsColl(NULL)
78 , fTofHitMatchColl(NULL)
100 , fhDataRateRpc(NULL)
102 , fhDataRateType(NULL)
103 , fhTofDataPerEvt(NULL)
104 , fhTofDataRedEvt(NULL)
113 , fhTofPosDifSingXX(NULL)
114 , fhTofPosDifSingXY(NULL)
115 , fhTofPosDifSingXZ(NULL)
116 , fhTofPosDifSingY(NULL)
117 , fhTofPosDifSingZ(NULL)
118 , fhTofPosDifXZSing(NULL)
119 , fhTofBadXPosSing(NULL)
120 , fhTofBadYPosSing(NULL)
121 , fhTofBadZPosSing(NULL)
126 cout <<
"CbmTofTests: Task started " << endl;
132 : FairTask(name, verbose)
146 , fTofPointsColl(NULL)
147 , fMcTracksColl(NULL)
150 , fTofHitMatchColl(NULL)
151 , fhTestingTime(NULL)
155 , fhPointMapAng(NULL)
156 , fhPointMapSph(NULL)
168 , fhDigiFluxMap(NULL)
172 , fhDataRateRpc(NULL)
174 , fhDataRateType(NULL)
175 , fhTofDataPerEvt(NULL)
176 , fhTofDataRedEvt(NULL)
185 , fhTofPosDifSingXX(NULL)
186 , fhTofPosDifSingXY(NULL)
187 , fhTofPosDifSingXZ(NULL)
188 , fhTofPosDifSingY(NULL)
189 , fhTofPosDifSingZ(NULL)
190 , fhTofPosDifXZSing(NULL)
191 , fhTofBadXPosSing(NULL)
192 , fhTofBadYPosSing(NULL)
193 , fhTofBadZPosSing(NULL)
222 Bool_t isSimulation = kFALSE;
224 if (
k12b > iGeoVersion) {
225 LOG(error) <<
"CbmTofDigitizerBDF::InitParameters => Only compatible with "
226 "geometries after v12b !!!";
230 LOG(info) <<
"CbmTofDigitizerBDF::InitParameters: GeoVersion " << iGeoVersion;
232 switch (iGeoVersion) {
236 LOG(error) <<
"CbmTofDigitizerBDF::InitParameters: Invalid Detector ID "
243 LOG(info) <<
" CbmTofTests => Get the digi parameters for tof";
246 FairRunAna* ana = FairRunAna::Instance();
247 FairRuntimeDb* rtdb = ana->GetRuntimeDb();
257 LOG(debug) <<
" CbmTofTests => New event";
263 + (
fStop.GetNanoSec() -
fStart.GetNanoSec()) / 1e9);
266 cout <<
"-I- CbmTofTests::Exec : "
267 <<
"event " <<
fEvents <<
" processed." << endl;
274 cout <<
"CbmTofTests::Finish up with " <<
fEvents <<
" analyzed events "
277 Double_t dEvtRate = 1. /
fEvents;
278 Double_t dIntRate = 1.E7;
279 Double_t dOptLinkCapa = 2.5;
280 Double_t dOptLinkAvBw =
282 Double_t dKiloByte = 1024;
283 Double_t dMegaByte = 1024 * dKiloByte;
284 Double_t dGigaByte = 1024 * dMegaByte;
286 cout <<
"<I> Normalisation factors " << dIntRate * dEvtRate <<
" [1/s], "
287 << dOptLinkCapa * dOptLinkAvBw <<
" [GByte/s]" << endl;
301 / (dOptLinkCapa * dOptLinkAvBw));
302 fhOptLnkSm->Scale(dIntRate * dEvtRate / dGigaByte
303 / (dOptLinkCapa * dOptLinkAvBw));
305 / (dOptLinkCapa * dOptLinkAvBw));
315 FairRootManager* fManager = FairRootManager::Instance();
326 LOG(error) <<
"CbmTofTests::RegisterInputs => Could not get the TofPoint "
331 fMcTracksColl = (TClonesArray*) fManager->GetObject(
"MCTrack");
333 LOG(error) <<
"CbmTofTests::RegisterInputs => Could not get the MCTrack "
338 fTofDigisColl = (TClonesArray*) fManager->GetObject(
"TofDigi");
340 LOG(error) <<
"CbmTofTests::RegisterInputs => Could not get the TofDigi "
345 fTofHitsColl = (TClonesArray*) fManager->GetObject(
"TofHit");
347 LOG(error) <<
"CbmTofTests::RegisterInputs => Could not get the TofHit "
354 LOG(error) <<
"CbmTofHitFinderQa::RegisterInputs => Could not get the "
355 "TofHitMatch TClonesArray!!!";
433 for (Int_t iSmType = 0; iSmType < iNbSmTypes; iSmType++) {
443 for (Int_t iSm = 0; iSm < iNbSm; iSm++) {
448 for (Int_t iRpc = 0; iRpc < iNbRpc; iRpc++) {
469 new TH1I(
"TofDigiBdf_TestingTime",
470 "Time needed to for the test processing in each event; Time [s]",
489 Double_t xrange = 750.;
490 Double_t yrange = 500.;
491 Double_t zmin = 950.;
492 Double_t zmax = 1100.;
495 Int_t iNbBinThetaX = 1200;
496 Double_t dThetaXMin = -60.0;
497 Double_t dThetaXMax = 60.0;
498 Int_t iNbBinThetaY = 800;
499 Double_t dThetaYMin = -40.0;
500 Double_t dThetaYMax = 40.0;
509 Int_t iNbBinPhi = 180;
510 Double_t dPhiMin = 0;
511 Double_t dPhiMax =
TMath::Pi() * 90 / 180;
512 Int_t iNbBinTheta = 180;
519 new TH2D(
"TofTests_PointsMapXY",
520 "Position of the Tof Points; X[cm]; Y[cm]; # [Points]",
528 new TH2D(
"TofTests_PointsMapXZ",
529 "Position of the Tof Points; X[cm]; Z[cm]; # [Points]",
537 new TH2D(
"TofTests_PointsMapYZ",
538 "Position of the Tof Points; Y[cm]; Z[cm]; # [Points]",
546 "Position of the Tof Points; #theta_{x}[Deg.]; "
547 "#theta_{y}[Deg.]; # [Points]",
555 new TH2D(
"TofTests_PointsMapSph",
556 "Position of the Tof Points; #theta[rad.]; #phi[rad.]; # [Points]",
565 "Position of the Tof Digis; X[cm]; Y[cm]; # [Digi]",
573 "Position of the Tof Digis; X[cm]; Z[cm]; # [Digi]",
581 "Position of the Tof Digis; Y[cm]; Z[cm]; # [Digi]",
589 "TofTests_DigisMapAng",
590 "Position of the Tof Digis; #theta_{x}[Deg.]; #theta_{y}[Deg.]; # [Digi]",
598 new TH2D(
"TofTests_DigisMapSph",
599 "Position of the Tof Digis; #theta[rad.]; #phi[rad.]; # [Points]",
609 "Position of the Tof Hits; X[cm]; Y[cm]; # [Hits]",
617 "Position of the Tof Hits; X[cm]; Z[cm]; # [Hits]",
625 "Position of the Tof Hits; Y[cm]; Z[cm]; # [Hits]",
633 "TofTests_HitsMapAng",
634 "Position of the Tof Hits; #theta_{x}[Deg.]; #theta_{y}[Deg.]; # [Hits]",
642 new TH2D(
"TofTests_HitsMapSph",
643 "Position of the Tof Hits; #theta[rad.]; #phi[rad.]; # [Points]",
655 "Tof Point rate as function of position; X[cm]; Y[cm]; Flux [1/(s*cm^2)]",
663 "TofTests_DigisFluxMap",
664 "Tof Hit rate as function of position; X[cm]; Y[cm]; Flux [Digi/(s*cm^2)]",
672 "TofTests_HitsFluxMap",
673 "Tof Hit rate as function of position; X[cm]; Y[cm]; Flux [Hits/(s*cm^2)]",
681 "Digi rate per channel; Channel []; Rate [1/s]",
686 "Data rate per channel; Channel []; Data Rate [kB/s]",
691 "Data rate per RPC; RPC []; Rate [GB/s]",
696 "Data rate per SM; SM []; Rate [GB/s]",
701 "Data rate per SM; SM Type[]; Rate [GB/s]",
706 new TH1D(
"TofTests_DataPerEvt",
707 "Data per event for the full wall; Event Size [kB]",
712 "Possible data reduction per event for the full "
713 "wall; Event Size Reduction [kB]",
720 "Number of optical links needed per RPC; RPC []",
725 new TH1D(
"TofTests_OptLnkSm",
726 "Number of optical links needed per SM; SM []; Optical Links []",
731 "TofTests_OptLnkType",
732 "Number of optical links needed per SM type; SM Type[]; Optical Links []",
740 "Time difference between TofHits and TofPoint; tMcPoint -tTofHit [ns]",
745 "Time difference between TofHits and TofPoint, only "
746 "1 MC Track/Point per Hit; tMcPoint -tTofHit [ns]",
753 "Position Accuracy of the Tof Hits in X; X[cm]; PtX - HitX[cm]; # [Hits]",
762 "Position Accuracy of the Tof Hits in Y; Y[cm]; PtY - HitY[cm]; # [Hits]",
771 "Position Accuracy of the Tof Hits in Z; Z[cm]; PtZ - HitZ[cm]; # [Hits]",
779 new TH2D(
"TofTests_PosDifSingXX",
780 "Position Accuracy of the Tof Hits in X, hits from single MC "
781 "point; Pt X[cm]; PtX - HitX[cm]; # [Hits]",
789 new TH2D(
"TofTests_PosDifSingXY",
790 "Position Accuracy of the Tof Hits in X, hits from single MC "
791 "point; Pt Y[cm]; PtX - HitX[cm]; # [Hits]",
799 new TH2D(
"TofTests_PosDifSingXZ",
800 "Position Accuracy of the Tof Hits in X, hits from single MC "
801 "point; Pt Z[cm]; PtX - HitX[cm]; # [Hits]",
809 new TH2D(
"TofTests_PosDifSingY",
810 "Position Accuracy of the Tof Hits in Y, hits from single MC "
811 "point; Pt Y[cm]; PtY - HitY[cm]; # [Hits]",
819 new TH2D(
"TofTests_PosDifSingZ",
820 "Position Accuracy of the Tof Hits in Z, hits from single MC "
821 "point; Pt Z[cm]; PtZ - HitZ[cm]; # [Hits]",
829 new TH2D(
"TofTests_PosDifXZSing",
830 "Position Accuracy of the Tof Hits in Z, hits from single MC "
831 "point; PtX - HitX[cm]; PtZ - HitZ[cm]; # [Hits]",
840 new TH2D(
"TofTests_BadXPosSing",
841 "Position of the Tof Hits; X[cm]; Y[cm]; # [Hits]",
849 new TH2D(
"TofTests_BadYPosSing",
850 "Position of the Tof Hits; X[cm]; Y[cm]; # [Hits]",
858 new TH2D(
"TofTests_BadZPosSing",
859 "Position of the Tof Hits; X[cm]; Y[cm]; # [Hits]",
867 fhTofEff =
new TH1I(
"TofTests_TofEff",
868 "Fraction of tracks reaching Tof producing a non mixed "
869 "TofHit; # non-mixed Hits/ # Tof Tracks []",
874 "Fraction of TofHits built from more than 1 McTrack; "
875 "# mixed Hits/ # Hits []",
890 Int_t iDataSizeHit = 48;
898 Int_t iNbTracks, iNbTofPts, iNbTofDigis, iNbTofHits;
906 Int_t iNbTofTracks = 0;
907 Int_t iNbTofTracksPrim = 0;
908 for (Int_t iTrkInd = 0; iTrkInd < iNbTracks; iTrkInd++) {
919 for (Int_t iPntInd = 0; iPntInd < iNbTofPts; iPntInd++) {
925 pTofPoint->Position(vPntPos);
927 Double_t dX = vPntPos.X();
928 Double_t dY = vPntPos.Y();
929 Double_t dZ = vPntPos.Z();
936 Double_t dThetaX = TMath::ATan2(dX, dZ) * 180.0 /
TMath::Pi();
937 Double_t dThetaY = TMath::ATan2(dY, dZ) * 180.0 /
TMath::Pi();
941 TMath::ATan2(TMath::Sqrt(dX * dX + dY * dY), dZ);
942 Double_t dTheta = TMath::ATan2(dY, dX);
947 Double_t dTotalDataSize = 0;
950 for (Int_t iDigInd = 0; iDigInd < iNbTofDigis; iDigInd++) {
953 Int_t iSmType = pDigi->
GetType();
954 Int_t iSm = pDigi->
GetSm();
955 Int_t iRpc = pDigi->
GetRpc();
974 Double_t dThetaX = TMath::ATan2(dX, dZ) * 180.0 /
TMath::Pi();
975 Double_t dThetaY = TMath::ATan2(dY, dZ) * 180.0 /
TMath::Pi();
979 TMath::ATan2(TMath::Sqrt(dX * dX + dY * dY), dZ);
980 Double_t dTheta = TMath::ATan2(dY, dX);
983 Int_t iGlobalChan = iCh +
fvRpcChOffs[iSmType][iSm][iRpc];
984 Int_t iGlobalRpc = iRpc +
fvSmRpcOffs[iSmType][iSm];
995 dTotalDataSize += iDataSizeHit;
1002 Int_t iNbMixedHits = 0;
1003 for (Int_t iHitInd = 0; iHitInd < iNbTofHits; iHitInd++) {
1010 Double_t dX = pTofHit->
GetX();
1011 Double_t dY = pTofHit->
GetY();
1012 Double_t dZ = pTofHit->
GetZ();
1019 Double_t dThetaX = TMath::ATan2(dX, dZ) * 180.0 /
TMath::Pi();
1020 Double_t dThetaY = TMath::ATan2(dY, dZ) * 180.0 /
TMath::Pi();
1024 TMath::ATan2(TMath::Sqrt(dX * dX + dY * dY), dZ);
1025 Double_t dTheta = TMath::ATan2(dY, dX);
1040 if (1 == iNbPntHit) {
1047 pPt->GetZ() - pTofHit->
GetZ());
1049 if (pPt->GetX() - pTofHit->
GetX() < -0.7
1050 || 0.7 < pPt->GetX() - pTofHit->
GetX())
1053 if (pPt->GetY() - pTofHit->
GetY() < -2.0
1054 || 2.0 < pPt->GetY() - pTofHit->
GetY())
1057 if (pPt->GetZ() - pTofHit->
GetZ() < -0.6
1058 || 0.6 < pPt->GetZ() - pTofHit->
GetZ())
1068 if (0 < iNbTofHits)
fhTofMixing->Fill(iNbMixedHits / iNbTofHits);
1078 TDirectory* oldir = gDirectory;
1079 TFile* fHist =
new TFile(
"./tofTests.hst.root",
"RECREATE");
1139 gDirectory->cd(oldir->GetPath());