77 {
78 MsgStream log(messageService(), name());
79 log << MSG::INFO << "CgemDigitizerSvc::initialize()" << endreq;
80
81 StatusCode sc = Service::initialize();
82 if( sc.isFailure() ) return sc;
83
84 static IJobOptionsSvc* jobSvc = 0;
85 if ( jobSvc == 0 ) {
86 sc = service("JobOptionsSvc", jobSvc);
87 if ( sc.isFailure() ) {
88 std::cout << "Can't get the JobOptionsSvc @ DistBoss::GetPropertyValue()" << std::endl;
89 return sc;
90 }
91 }
92
93
94 const vector<const Property*>* properties = jobSvc->getProperties("BesRndmGenSvc");
95
96 if ( properties == NULL ) {
97 std::cout << "In CgemDigitizerSvc::initialize(), can't get client: " << std::endl;
98 return StatusCode::FAILURE;
99 }
100
101 unsigned int randSeed;
102 for ( unsigned int i = 0; i < properties->size(); ++i ) {
103 if ( properties->at(i)->name() == "RndmSeed" ) {
104 cout << "name of property: " << properties->at(i)->name() << endl;
105 string strRnd = properties->at(i)->toString();
106 sscanf(strRnd.c_str(), "%u", &randSeed);
107 cout << "random seed from jobOption: " << randSeed << endl;
108 break;
109 }
110 }
111
112 sc = service("CgemGeomSvc", m_geomSvc);
113 if(sc != StatusCode::SUCCESS)
114 {
115 log << MSG::ERROR << "can not use CgemGeomSvc" << endreq;
116 return StatusCode::FAILURE;
117 }
118
119 gRandom->SetSeed(randSeed);
120
121 cout << "ionModel = " << m_ionModel << endl;
122 if(1 == m_ionModel){
124 } else if(2 == m_ionModel){
126 }
127
129 m_pIon->
init(randSeed, m_geomSvc, m_magConfig);
130
131 if ((3==m_driftAvaModel && 3!=m_inductionModel )||(3!=m_driftAvaModel && 3==m_inductionModel )) {
132 cout<<"CgemDigitizerSvc::initialize() Error: DriftAvalancheModel type3 and InductionModel type3 must be used together!"<<endl;
133 return StatusCode::FAILURE;
134 }
135
136 if(1 == m_driftAvaModel){
142 } else if(2 == m_driftAvaModel){
144 } else if(3 == m_driftAvaModel){
148
149
153
158
159 }
160 m_pDriftAndAva->
init(m_geomSvc, m_magConfig);
162
163 if(1 == m_inductionModel){
171 m_pInduction = indGar;
172
177 } else if(2 == m_inductionModel){
179
180 }else if (3 == m_inductionModel){
185
190 }
191 m_pInduction->
init(m_geomSvc, m_magConfig);
193
194
195 cout<<"CgemDigitizerSvc:"<<endl;
196 cout<<"gapShift_microSector="<<m_gapShift_microSector[0]
197 <<", "<<m_gapShift_microSector[1]
198 <<", "<<m_gapShift_microSector[2]
199 <<", "<<m_gapShift_microSector[3]
200 <<", "<<m_gapShift_microSector[4]
201 <<", "<<m_gapShift_microSector[5]
202 <<endl;
203 cout<<"microSector_width="<<m_microSector_width[0]
204 <<", "<<m_microSector_width[1]
205 <<", "<<m_microSector_width[2]
206 <<", "<<m_microSector_width[3]
207 <<", "<<m_microSector_width[4]
208 <<", "<<m_microSector_width[5]
209 <<endl;
210 cout<<"QinGausSigma="<<m_QinGausSigma[0]
211 <<", "<<m_QinGausSigma[1]
212 <<endl;
213 cout<<"Ngaps_microSector="<<m_Ngaps_microSector<<endl;
214 cout<<"gap_microSector="<<m_gap_microSector<<endl;
215
216
217 TFile *LUTFile = TFile::Open(m_LUTFilePath.c_str(),"read");
218 TTree *tree = (TTree*)LUTFile->Get("tree");
220 Int_t layer,sheet,strip_v,strip_x;
221 tree->SetBranchAddress("strip_x_boss", &strip_x);
222 tree->SetBranchAddress("strip_v_boss", &strip_v);
223 tree->SetBranchAddress("layer", &layer);
224 tree->SetBranchAddress("sheet", &sheet);
225 tree->SetBranchAddress("calib_QDC_saturation", &QDC_saturation);
226 for(int i=0;i<tree->GetEntries();i++) {
227 tree->GetEntry(i);
228 if(strip_x!=-1) {
229 Qsaturation[layer][sheet][0][strip_x] = QDC_saturation;
230 }
231 if(strip_v!=-1) {
232 Qsaturation[layer][sheet][1][strip_v] = QDC_saturation;
233 }
234 }
235 for(int i=0;i<832;i++) {
236 Qsaturation[2][0][0][i] = 45.;
237 Qsaturation[2][1][0][i] = 45.;
238 }
239 for(int i=0;i<1395;i++) {
240 Qsaturation[2][0][1][i] = 45.;
241 Qsaturation[2][1][1][i] = 45.;
242 }
243 LUTFile->Close();
244
245
246 if(m_saveNt) {
248 Gaudi::svcLocator() -> service(
"NTupleSvc",
ntupleSvc);
249 NTuplePtr nt(
ntupleSvc,
"CgemDigitizerSvcNT/digi");
250
251 if(nt) m_tuple = nt;
252 else{
253 m_tuple =
ntupleSvc->book(
"CgemDigitizerSvcNT/digi", CLID_ColumnWiseTuple,
"noise");
254 if(m_tuple){
255 m_tuple->addItem("nIonE", m_ntNIonE);
256 m_tuple->addItem("nMultiE", m_ntNMultiE);
257 m_tuple->addItem("nXstrips", m_ntNxstrips,0,100);
258 m_tuple->addItem("nVstrips", m_ntNvstrips,0,100);
259 m_tuple->addIndexedItem("XstripQ", m_ntNxstrips,m_ntxstripQ);
260 m_tuple->addIndexedItem("XstripT", m_ntNxstrips,m_ntxstripT);
261 m_tuple->addIndexedItem("VstripQ", m_ntNvstrips,m_ntvstripQ);
262 m_tuple->addIndexedItem("VstripT", m_ntNvstrips,m_ntvstripT);
263 m_tuple->addIndexedItem("XstripID", m_ntNxstrips,m_XstripID);
264 m_tuple->addIndexedItem("VstripID", m_ntNvstrips,m_VstripID);
265 }
266 }
267 }
268
269 return StatusCode::SUCCESS;
270}
virtual void init(ICgemGeomSvc *geomSvc, double magConfig)=0
virtual void setDebugging(bool debugging)=0
void setQinGausSigma(vector< double > sigma)
void setScaleSignalX(double ScaleSignalX)
void setGapSizeSect(double size)
void setMicroSectorWidthRad(vector< double > width)
void setScaleSignalX(double ScaleSignalX)
void setQinGausSigma(vector< double > sigma)
void setGapShiftSect(vector< double > shift)
virtual void setStoreFlag(bool flag)=0
virtual void setSaturation(bool flag)=0
virtual void setVsampleDelay(double delay)=0
virtual void setDebugOutput(bool debugOutput)=0
virtual void setLUTFilePath(std::string path)=0
virtual void init(ICgemGeomSvc *geomSvc, double magConfig)=0
virtual void setDebugging(bool debugging)=0
virtual void init(unsigned int random, ICgemGeomSvc *geomSvc, double magConfig)=0
void setTransMultiplier(double TransMultiplier)
void setGapSizeSect(double size)
void setGapShiftSect(vector< double > shift)
void setGainMultiplier(vector< double > GainMultiplier)
void setDiffuMultiplier(double DiffuMultiplier)
void setMultiElectronMapAddr(HitHistMap *address)
void setMicroSectorWidthRad(vector< double > width)
void setGainMultiplier(vector< double > GainMultiplier)
void setDiffuMultiplier(double DiffuMultiplier)
void setTransMultiplier(double TransMultiplier)