57 cout <<
"\nBmnSiProfDigitizer::Init()\n ";
59 if (fVerbose && fOnlyPrimary)
60 cout <<
" Only primary particles are processed!!! " << endl;
62 if (fVerbose && fStripMatching)
63 cout <<
" Strip Matching is activated!!! " << endl;
65 cout <<
" Strip Matching is deactivated!!! " << endl;
67 FairRootManager* ioman = FairRootManager::Instance();
69 fBmnSiProfPointsArray = (TClonesArray*)ioman->GetObject(fInputBranchName);
70 if (!fBmnSiProfPointsArray) {
71 cout <<
"BmnSiProfDigitizer::Init(): branch " << fInputBranchName <<
" not found! Task will be deactivated"
77 fMCTracksArray = (TClonesArray*)ioman->GetObject(
"MCTrack");
79 fBmnSiProfDigitsArray =
new TClonesArray(fOutputDigitsBranchName);
80 ioman->Register(fOutputDigitsBranchName,
"SiProf_DIGIT", fBmnSiProfDigitsArray, kTRUE);
83 fBmnSiProfDigitMatchesArray =
new TClonesArray(
"BmnMatch");
84 ioman->Register(fOutputDigitMatchesBranchName,
"SiProf_DIGIT", fBmnSiProfDigitMatchesArray, kTRUE);
87 TString gPathSiProfConfig = gSystem->Getenv(
"VMCWORKDIR");
88 gPathSiProfConfig +=
"/parameters/profilometer/XMLConfigs/";
91 switch (fCurrentConfig) {
93 XMLConfigFile = gPathSiProfConfig +
"ProfRun8.xml";
95 cout <<
" Current SiProf Configuration : Run8"
100 XMLConfigFile = gPathSiProfConfig +
"ProfRun9.xml";
102 cout <<
" Current SiProf Configuration : Run9"
109 if (!gSystem->AccessPathName(XMLConfigFile)) {
111 cout <<
" XMLConfigFile : " << XMLConfigFile <<
"\n";
116 Fatal(
"BmnSiProfDigitizer::Init()",
" !!! Current configuration is not set !!! ");
122 cout <<
"BmnSiProfDigitizer::Init() finished\n\n";
132 clock_t tStart = clock();
133 fBmnSiProfDigitsArray->Delete();
135 if (fStripMatching) {
136 fBmnSiProfDigitMatchesArray->Delete();
139 if (!fBmnSiProfPointsArray) {
140 Error(
"BmnSiProfDigitizer::Exec()",
" !!! Unknown branch name !!! ");
145 cout <<
" BmnSiProfDigitizer::Exec(), Number of BmnSiProfPoints = " << fBmnSiProfPointsArray->GetEntriesFast()
152 cout <<
" BmnSiProfDigitizer::Exec() finished\n\n";
154 clock_t tFinish = clock();
155 workTime += ((Float_t)(tFinish - tStart)) / CLOCKS_PER_SEC;
161 FairMCPoint* SiProfPoint;
162 Int_t NNotPrimaries = 0;
164 for (Int_t ipoint = 0; ipoint < fBmnSiProfPointsArray->GetEntriesFast(); ipoint++) {
165 SiProfPoint = (FairMCPoint*)fBmnSiProfPointsArray->At(ipoint);
177 Double_t x = -SiProfPoint->GetX();
178 Double_t y = SiProfPoint->GetY();
179 Double_t z = SiProfPoint->GetZ();
181 Double_t px = -SiProfPoint->GetPx();
182 Double_t py = SiProfPoint->GetPy();
183 Double_t pz = SiProfPoint->GetPz();
185 Double_t dEloss = SiProfPoint->GetEnergyLoss() * 1e6;
186 Int_t refId = ipoint;
189 Int_t mc_station_num = ((
BmnSiProfPoint*)SiProfPoint)->GetStation();
190 Int_t mc_module_num = ((
BmnSiProfPoint*)SiProfPoint)->GetModule();
197 if (TransfSet && mc_station_num < StationSet->GetNStations()) {
198 if (mc_module_num < StationSet->GetStation(mc_station_num)->GetNModules()) {
199 Plane3D::Point loc_point =
202 Plane3D::Point(-(px + x), (py + y), (pz + z)), mc_station_num, mc_module_num);
207 px = -(loc_direct.X() - loc_point.X());
208 py = loc_direct.Y() - loc_point.Y();
209 pz = loc_direct.Z() - loc_point.Z();
217 if (fVerbose && fOnlyPrimary)
218 cout <<
" Number of not primaries points : " << NNotPrimaries <<
"\n";
220 cout <<
" Processed MC points : " << NAddedPoints <<
"\n";
222 for (Int_t iStation = 0; iStation < StationSet->
GetNStations(); ++iStation) {
225 for (Int_t iModule = 0; iModule < station->
GetNModules(); ++iModule) {
228 for (Int_t iLayer = 0; iLayer <
module->GetNStripLayers(); ++iLayer) {
231 for (Int_t iStrip = 0; iStrip < layer.
GetNStrips(); ++iStrip) {
234 new ((*fBmnSiProfDigitsArray)[fBmnSiProfDigitsArray->GetEntriesFast()])
237 if (fStripMatching) {
238 new ((*fBmnSiProfDigitMatchesArray)[fBmnSiProfDigitMatchesArray->GetEntriesFast()])
Bool_t AddPointToDetector(Double_t xcoord, Double_t ycoord, Double_t zcoord, Double_t px, Double_t py, Double_t pz, Double_t dEloss, Int_t refID)