20 #include "TGeoManager.h"
21 #include "TGeoMatrix.h"
22 #include "TGeoVolume.h"
25 #include "FairEventHeader.h"
26 #include "FairLogger.h"
27 #include "FairMCEventHeader.h"
28 #include "FairPrimaryGenerator.h"
29 #include "FairRunAna.h"
30 #include "FairRunSim.h"
55 , foutputCluster(NULL)
57 foutputDigiMatch(NULL)
59 , fcurrentPoints(NULL)
60 , fcurrentEventTime(0.)
65 , fAlignmentCorr(NULL)
70 , fPluginArray(new TObjArray(1))
71 , fSensorStartTime(0.)
72 , initialized(kFALSE) {
73 cout <<
"-W- " << GetName()
74 <<
": MVD-Sensor initialized without technical data.";
75 cout <<
" Assuming default sensor." << endl;
77 cout <<
"-W- " << GetName()
78 <<
": MVD-Sensor initialized without geometry data. ";
79 cout <<
" Must be added manually before using this class." << endl;
81 cout <<
"-W- " << GetName()
82 <<
": MVD-Sensor initialized without valid start time. ";
83 cout <<
" Must be added manually before using this class." << endl;
95 Double_t sensorStartTime)
98 , fSensorNr(stationNr)
100 , fDetectorID(DetectorId(stationNr))
106 , fNodeName(nodeName)
108 , foutputCluster(NULL)
110 foutputDigiMatch(NULL)
111 , foutputBuffer(NULL)
112 , fcurrentPoints(NULL)
113 , fcurrentEventTime(0.)
118 , fAlignmentCorr(NULL)
121 , fSensorData(dataSheet)
123 , fPluginArray(new TObjArray(1))
124 , fSensorStartTime(sensorStartTime)
125 , initialized(kFALSE) {}
137 (TGeoHMatrix*) alignmentMatrix->Clone(
fNodeName +
"_AlignmentData");
144 LOG(debug1) <<
"-I- nodeName is " << nodeName;
151 gGeoManager->cd(nodeName);
152 volume = gGeoManager->GetCurrentVolume();
153 LOG(debug2) <<
"At volume: " << volume->GetName();
154 fShape = (TGeoBBox*) volume->GetShape();
155 fMCMatrix = (TGeoHMatrix*) (gGeoManager->GetCurrentMatrix())
156 ->Clone(nodeName +
"_MC_Matrix");
157 fMCMatrix->SetName(nodeName +
"_MC_Matrix");
159 Double_t
first[3], last[3];
162 LOG(debug2) <<
"pixel 0,0 at: " <<
first[0] <<
", " <<
first[1] <<
" Local";
165 << last[1] <<
" Local";
167 Double_t* tempCoordinate;
170 Double_t pre[3], past[3], global[3];
171 Double_t local[3] = {0, 0, 0};
177 for (Int_t
i = 0;
i < 3;
i++) {
178 tempCoordinate[
i] = tempCoordinate[
i] +
epsilon[
i];
182 LOG(debug2) <<
"shifted pixel 0,0 to: " << past[0] <<
", " << past[1]
183 <<
" at z = " << past[2];
185 LOG(debug2) <<
"shifted local center to: " << global[0] <<
", " << global[1]
186 <<
" at z = " << global[2];
195 for (Int_t
i = 0;
i < 3;
i++) {
218 TClonesArray* dataArray;
225 for (Int_t
i = 0;
i < nPlugin;
i++) {
239 for (Int_t
i = 0;
i < nPlugin - 1;
i++) {
256 LOG(debug) <<
"No Plugins on this Sensor ";
271 <<
"Set debug mode on Plugin " <<
fPluginArray->GetEntriesFast() - 1
272 <<
" at sensor " << GetName() << endl;
288 TString digitizername =
"CbmMvdSensorDigitizerTask";
290 if (pluginFirst->ClassName() == digitizername) {
296 LOG(fatal) <<
"Invalid input typ";
300 cout << endl <<
"ERROR!! undefind plugin!" << endl;
315 TString digitizername =
"CbmMvdSensorDigitizerTask";
316 TString digitizerTBname =
"CbmMvdSensorDigitizerTBTask";
318 if (pluginFirst->ClassName() == digitizername
319 || pluginFirst->ClassName() == digitizerTBname) {
325 LOG(fatal) <<
"Invalid input typ";
329 cout << endl <<
"ERROR!! undefind plugin!" << endl;
343 cout << endl <<
"Somthing seems fishy here" << endl;
357 cout << endl <<
"Somthing seems fishy here" << endl;
371 cout << endl <<
"Somthing seems fishy in SendInputCluster" << endl;
382 FairRunSim* run = FairRunSim::Instance();
383 FairRunAna* ana = FairRunAna::Instance();
385 FairEventHeader*
event = run->GetEventHeader();
389 FairEventHeader*
event = ana->GetEventHeader();
407 for (Int_t
i = 1;
i < nPlugin;
i++) {
422 if (nPlugin > nPluginMax) {
423 Fatal(GetName(),
" Error - Called non-existing plugin");
430 FairRunSim* run = FairRunSim::Instance();
431 FairPrimaryGenerator* gen = run->GetPrimaryGenerator();
432 FairMCEventHeader*
event = gen->GetEvent();
445 if (nPlugin < maxPlugin) {
450 for (UInt_t
i = 1;
i <= nPlugin;
i++) {
457 cout << endl <<
"nPlugin to large" << endl;
464 FairRunSim* run = FairRunSim::Instance();
465 FairPrimaryGenerator* gen = run->GetPrimaryGenerator();
466 FairMCEventHeader*
event = gen->GetEvent();
474 if (nPlugin <= maxPlugin) {
479 for (UInt_t
i = nPlugin + 1;
i < maxPlugin;
i++) {
486 cout << endl <<
"nPlugin to large" << endl;
498 Int_t ArrayLength = digiplugin->
GetOutputArray()->GetEntriesFast() - 1;
499 if (ArrayLength >= 0) {
509 Int_t ArrayLength = clusterplugin->
GetOutputArray()->GetEntriesFast() - 1;
510 if (ArrayLength >= 0)
515 LOG(fatal) <<
"undefined plugin: " << nPlugin <<
" called";
538 LOG(fatal) <<
"undefined plugin called";
584 Int_t& pixelNumberY) {
635 Int_t& pixelNumberY) {
644 Double_t absoluteTime)
const {
649 Double_t timeInUnitsOfFrames =
653 Double_t timeSinceStartOfTheFrame =
654 timeInUnitsOfFrames - (Int_t) timeInUnitsOfFrames;
656 Int_t rowUnderReadout =
660 return (Int_t)(timeInUnitsOfFrames + (pixelNumberY < rowUnderReadout));
675 Double_t timeInUnitsOfFrames =
678 Int_t nextFrame = (Int_t)(timeInUnitsOfFrames + 1);
689 cout <<
" --- " << GetName() <<
", sensor name" <<
fVolName << endl;
690 cout <<
" MC - ID: " <<
fVolumeId << endl;
691 cout <<
"---------------------------------------------------------" << endl;
692 cout <<
" Position information: " << endl;
694 cout <<
" --------------------------------------------------------" << endl;
695 cout <<
" Technical information: " << endl;
697 cout <<
" , MC Id " <<
fVolumeId << endl;
698 cout <<
"---------------------------------------------------------" << endl;
706 for (Int_t
i = 0;
i < nPlugin;
i++) {