31 if (fDebug) cout <<
" BmnSiliconHitProducerSRC::Init() " << endl;
35 FairRootManager* ioman = FairRootManager::Instance();
37 fBmnPointsArray = (TClonesArray*) ioman->GetObject(fInputBranchName);
38 fMCTracksArray = (TClonesArray*) ioman->GetObject(
"MCTrack");
40 fBmnHitsArray =
new TClonesArray(
"BmnHit");
41 ioman->Register(fOutputHitsBranchName,
"SILICON", fBmnHitsArray, kTRUE);
43 fBmnHitsArray2 =
new TClonesArray(
"BmnHit");
44 ioman->Register(fOutputHitsBranchName2,
"SILICON", fBmnHitsArray2, kTRUE);
46 TString gPathConfig = gSystem->Getenv(
"VMCWORKDIR");
47 gPathConfig +=
"/parameters/silicon/XMLConfigs/";
52 hdX =
new TH1D(
"dX",
"dX ", 100,-0.015,0.015); fList.Add(hdX);
53 hdXp =
new TH1D(
"dXp",
"dXp ", 100,-0.017,0.017);fList.Add(hdXp);
61 fBmnHitsArray->Delete();
62 fBmnHitsArray2->Delete();
65 if (fDebug) cout<<
"======================== BmnSiliconHitProducerSRC ========================"<<endl;
67 if (!fBmnPointsArray) {
68 Error(
"BmnSiliconHitProducerSRC::Init()",
" !!! Unknown branch name !!! ");
72 Float_t err[3] = {0.0030, 0.0035, 0.};
74 for (Int_t iPoint = 0; iPoint < fBmnPointsArray->GetEntriesFast(); iPoint++) {
80 if (charge == 0)
continue;
83 Double_t Pz = siliconPoint->GetPz();
84 Int_t pdgId = siliconPoint->
GetPdgId();
85 if (IsPrimary == 0)
continue;
86 if (Pz < 1.)
continue;
88 Int_t track_id = siliconPoint->GetTrackID();
89 Float_t dX = rand_gen.Gaus(0,err[0]);
90 Float_t dXp= rand_gen.Gaus(0,err[1]);
91 Float_t dZ = rand_gen.Gaus(0,err[2]);
92 if (fDebug) hdX ->Fill(dX);
93 if (fDebug) hdXp->Fill(dXp);
95 Float_t x = siliconPoint->
GetXIn();
96 Float_t y = siliconPoint->
GetYIn();
97 Float_t z = siliconPoint->
GetZIn();
98 Float_t xp = y*tan(2.5*TMath::Pi()/180.) + x;
100 Float_t x_smeared = siliconPoint->
GetXIn() + dX;
101 Float_t xp_smeared = xp + dXp;
102 Float_t z_smeared = siliconPoint->
GetZIn() + dZ;
104 if (fDebug) cout<<
" track_id "<<track_id<<
" charge "<<charge<<
" x "<<x<<
" x_sm "<<x_smeared<<
" y "<<y<<
" y_sm "<<(xp_smeared - x_smeared)/tan(2.5*TMath::Pi()/180.)<<
" xp_sm "<<xp_smeared<<
" z "<<z<<endl;
105 if (fDebug && z > -320.) cout<<
" ----------"<<endl;
109 if (fDebug) cout<<
" pdgId "<<pdgId<<endl;
113 BmnHit* hit =
new((*fBmnHitsArray)[fBmnHitsArray->GetEntriesFast()])
BmnHit(0, TVector3(x, y, z),
114 TVector3(err[0], err[1], err[2]), iPoint);
121 if(rand_gen.Uniform() <= .25) xp_smeared = -999.;
123 if(rand_gen.Uniform() <= .90) {
126 BmnHit* hit2 =
new((*fBmnHitsArray2)[fBmnHitsArray2->GetEntriesFast()])
BmnHit(0, TVector3(x_smeared, xp_smeared, z_smeared),
127 TVector3(err[0], err[1], err[2]), iPoint);