CGEM BOSS 6.6.5.f
BESIII Offline Software System
Loading...
Searching...
No Matches
bak_BesSim-00-04-14/src/BesRawDataWriter.cc
Go to the documentation of this file.
1//---------------------------------------------------------------------------//
2//// BOOST --- BESIII Object_Oriented Simulation Tool //
3////---------------------------------------------------------------------------//
4////Description:
5////Author: Dengzy
6////Created: Mar, 2004
7////Modified:
8////Comment:
9//
10#include "BesMdcDigi.hh"
11#include "BesCgemDigi.hh"
12#include "BesTofDigi.hh"
13#include "BesEmcDigi.hh"
14#include "BesMucDigi.hh"
15#include "BesRawDataWriter.hh"
16#include "G4DigiManager.hh"
17#include "G4Svc/IG4Svc.h"
18#include "G4Svc/G4Svc.h"
19
20#include "Randomize.hh"
21
22#include "GaudiKernel/IDataProviderSvc.h"
23#include "GaudiKernel/ISvcLocator.h"
24#include "GaudiKernel/Bootstrap.h"
25#include "GaudiKernel/RegistryEntry.h"
26#include "GaudiKernel/MsgStream.h"
27
28#include "MdcRawEvent/MdcDigi.h"
29#include "CgemRawEvent/CgemDigi.h"
30#include "TofRawEvent/TofDigi.h"
31#include "EmcRawEvent/EmcDigi.h"
32#include "MucRawEvent/MucDigi.h"
33
34#include "Identifier/Identifier.h"
35#include "Identifier/MdcID.h"
36#include "Identifier/CgemID.h"
37#include "Identifier/TofID.h"
38#include "Identifier/EmcID.h"
39#include "Identifier/MucID.h"
40
41#include "RawEvent/RawDataUtil.h"
42#include "RawEvent/DigiEvent.h"
43#include "GaudiKernel/SmartDataPtr.h"
44
45
47{
48 m_DigiMan = G4DigiManager::GetDMpointer();
49 //yuany 2005-2-28
50 mdcGeoPointer=BesMdcGeoParameter::GetGeo();
51
52 ICgemGeomSvc* ISvc;
53 StatusCode sc=Gaudi::svcLocator()->service("CgemGeomSvc", ISvc);
54 if (!sc.isSuccess())
55 G4cout <<" BesRawDataWriter::Error,could not open CgemGeomSvc"<<G4endl;
56 cgemGeoPointer=dynamic_cast<CgemGeomSvc *>(ISvc);
57
58 IG4Svc* tmpSvc;
59 sc=Gaudi::svcLocator()->service("G4Svc", tmpSvc);
60 if (!sc.isSuccess())
61 G4cout <<" BesRawDataWriter::Error,could not open G4Svc"<<G4endl;
62 m_G4Svc=dynamic_cast<G4Svc *>(tmpSvc);
63
64 IRealizationSvc *tmpReal;
65 StatusCode scReal = Gaudi::svcLocator()->service("RealizationSvc",tmpReal);
66 if (!scReal.isSuccess())
67 {
68 std::cout << " Could not initialize Realization Service in BesRawDataWriter" << std::endl;
69 }
70 else
71 {
72 m_RealizationSvc=dynamic_cast<RealizationSvc*>(tmpReal);
73 }
74
75}
76
78{
79}
80
82{
83 //interface to event data service
84 ISvcLocator* svcLocator = Gaudi::svcLocator();
85 StatusCode sc=svcLocator->service("EventDataSvc", m_evtSvc);
86 if (sc.isFailure())
87 G4cout<<"Could not accesss EventDataSvc!"<<G4endl;
88
89 DigiEvent* aDigiEvent = new DigiEvent;
90 sc = m_evtSvc->registerObject("/Event/Digi",aDigiEvent);
91 if(sc!=StatusCode::SUCCESS) {
92 G4cout<< "Could not register DigiEvent" <<G4endl;
93 }
94
100}
101
103{
104 //mdc digis collection defined in BOSS
105 MdcDigiCol* aMdcDigiCol = new MdcDigiCol;
106
107 G4int mdcDigiCollID = -1;
108 mdcDigiCollID = m_DigiMan->GetDigiCollectionID("BesMdcDigisCollection");
109 if(mdcDigiCollID>=0)
110 {
111 BesMdcDigisCollection* mdcDC = (BesMdcDigisCollection*)m_DigiMan->GetDigiCollection(mdcDigiCollID);
112 G4int nDigi = mdcDC->entries();
113 if(nDigi>0)
114 {
115 //push back mdc digits to MdcDigiCol in BOSS
116 BesMdcDigi* mdcDigi;
117 for(int i=0;i<nDigi;i++)
118 {
119 mdcDigi=(*mdcDC)[i];
120 unsigned int charge;
121 if(m_G4Svc->GetMdcDedxFlag()==1){
122 charge = int(mdcDigi->GetEdep());
123 }else{
124 charge = RawDataUtil::MdcChargeChannel(mdcDigi->GetEdep());
125 }
126 unsigned int time = RawDataUtil::MdcTimeChannel(mdcDigi->GetDriftT());
127 const Identifier ident = MdcID::wire_id ( mdcDigi->GetLayerNo(), mdcDigi->GetCellNo() );
128
129 MdcDigi* aMdcDigi = new MdcDigi(ident, time, charge);
130 aMdcDigi->setTrackIndex(mdcDigi->GetTrackID());
131 aMdcDigiCol->push_back(aMdcDigi);
132 }
133 }
134 }
135
136 //register MDC digits collection to TDS
137 StatusCode scMdc = m_evtSvc->registerObject("/Event/Digi/MdcDigiCol", aMdcDigiCol);
138 if(scMdc!=StatusCode::SUCCESS)
139 G4cout<< "Could not register MDC digi collection" <<G4endl;
140
141 //retrieve MDC digits from TDS
142 /*SmartDataPtr<MdcDigiCol> aDigiCol(m_evtSvc,"/Event/Digi/MdcDigiCol");
143 if(!aDigiCol)
144 G4cout<<"Could not retrieve MDC digi collection"<<G4endl;
145
146 MdcDigiCol::iterator iDigiCol;
147 for(iDigiCol=aDigiCol->begin(); iDigiCol!=aDigiCol->end(); iDigiCol++)
148 {
149 const Identifier ident = (*iDigiCol)->identify();
150 G4cout<<"layer: "<<MdcID::layer(ident);
151 G4cout<<" cell: "<<MdcID::wire(ident);
152 G4cout<<" charge: "<<(*iDigiCol)->getChargeChannel();
153 G4cout<<" time: "<<(*iDigiCol)->getTimeChannel()<<G4endl;
154 }
155 G4cout<<"end of retrieve MDC digi collection"<<G4endl;
156 */
157}
158
160{
161 bool printFlag=false;
162 if(printFlag) {
163 G4cout << "|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||" << G4endl;
164 G4cout << "INFO : BesSim::BesRawDataWriter::SaveCgemDigits(), Begin!" << G4endl;
165 }
166
167 /* cgem digis collection defined in BOSS */
168 CgemDigiCol* aCgemDigiCol = new CgemDigiCol;
169
170 G4int cgemDigiCollID = -1;
171 cgemDigiCollID = m_DigiMan->GetDigiCollectionID("BesCgemDigisCollection");
172 if (cgemDigiCollID >= 0)
173 {
174 BesCgemDigisCollection *cgemDC=(BesCgemDigisCollection*)m_DigiMan->GetDigiCollection(cgemDigiCollID);
175 G4int nDigi = cgemDC->entries();
176 if (nDigi > 0)
177 {
178 /* push back cgem digits to CgemDigiCol in BOSS */
179 BesCgemDigi* cgemDigi;
180 for(int i=0;i<nDigi;i++)
181 {
182 cgemDigi=(*cgemDC)[i];
183 unsigned int charge;
184
185 double stripEff = m_G4Svc->GetCgemStripEff();
186 G4double frandom = G4UniformRand();
187 // cout << setw(10) << cgemDigi->GetLayerID() << setw(10) << cgemDigi->GetStripID();
188 // cout << "stripEff = " << stripEff << " , frandom = " << frandom << endl;
189 if(frandom > stripEff) continue;
190
191 if(m_G4Svc->GetCgemDedxFlag()==1)
192 {
193 //charge = int(cgemDigi->GetEnergyDeposit());
194 charge = int(cgemDigi->GetEnergyDeposit()*1e10); /* Change MeV to eV */
195 //cout<<"use dE/dx flag!"<<endl;
196 }
197 else
198 {
200 }
201
202 unsigned int time = RawDataUtil::CgemTimeChannel(cgemDigi->GetGlobalTime());
203 const Identifier ident = CgemID::strip_id(cgemDigi->GetLayerID (),
204 cgemDigi->GetSheetID (),
205 cgemDigi->GetStripType (),
206 cgemDigi->GetStripID () );
207 if(printFlag)
208 G4cout << "digiID=" << ident.get_value()
209 << " layerID=" << CgemID::layer(ident)
210 << " sheetID=" << CgemID::sheet(ident)
211 << " isXstrip=" << CgemID::is_xstrip(ident)
212 << " stripID=" << CgemID::strip(ident)
213 << " time=" << time
214 << " charge=" << charge << G4endl;
215
216 CgemDigi* aCgemDigi = new CgemDigi(ident, time, charge);
217 aCgemDigi->setTrackIndex(cgemDigi->GetTrackID());
218 aCgemDigiCol->push_back(aCgemDigi);
219
220 } /* End of 'for(int i=0;i<nDigi;i++)' */
221 } /* End of 'if (nDigi > 0)' */
222 } /* End of 'if (cgemDigiCollID >= 0)' */
223
224 /* register CGEM digits collection to TDS */
225 StatusCode scCgem = m_evtSvc->registerObject("/Event/Digi/CgemDigiCol", aCgemDigiCol);
226 if(scCgem!=StatusCode::SUCCESS)
227 {
228 G4cout << "ERROR : BesSim::BesRawDataWriter::SaveCgemDigits(), Could not register CGEM digi collection! " << G4endl;
229 }
230
231
232 //std::cout<<__FILE__<<" "<<__LINE__<<std::endl;
233 //CgemDigiCol::iterator iter = aCgemDigiCol->begin();
234 //for ( ; iter != aCgemDigiCol->end(); iter++)
235 //{
236 // std::cout << " layer " << CgemID::layer((*iter)->identify())
237 // << " sheet " << CgemID::sheet((*iter)->identify())
238 // << " time " << (*iter)->getTimeChannel()
239 // << " charge " << (*iter)->getChargeChannel() << std::endl;
240 //}
241
242 //retrieve CGEM digits from TDS
243 /*SmartDataPtr<CgemDigiCol> aDigiCol(m_evtSvc,"/Event/Digi/CgemDigiCol");
244 if(!aDigiCol)
245 G4cout<<"Could not retrieve CGEM digi collection"<<G4endl;
246
247 CgemDigiCol::iterator iDigiCol;
248 for(iDigiCol=aDigiCol->begin(); iDigiCol!=aDigiCol->end(); iDigiCol++)
249 {
250 const Identifier ident = (*iDigiCol)->identify();
251 G4cout<<"layer: "<<CgemID::layer(ident);
252 G4cout<<" cell: "<<CgemID::wire(ident);
253 G4cout<<" charge: "<<(*iDigiCol)->getChargeChannel();
254 G4cout<<" time: "<<(*iDigiCol)->getTimeChannel()<<G4endl;
255 }
256 G4cout<<"end of retrieve CGEM digi collection"<<G4endl;
257 */
258}
259
261{
262 //Tof digits collection defined in BOSS
263 TofDigiCol* aTofDigiCol = new TofDigiCol;
264
265 G4int tofDigiCollID = -1;
266 tofDigiCollID = m_DigiMan->GetDigiCollectionID("BesTofDigitsCollection");
267
268 if(tofDigiCollID>=0)
269 {
270 BesTofDigitsCollection* tofDC = (BesTofDigitsCollection*)m_DigiMan->GetDigiCollection(tofDigiCollID);
271 G4int nDigi = tofDC->entries();
272 if(nDigi>0)
273 {
274 //arrange digis in digitsCollection in order of trackIndex
275
276 //std::cout << "BesRawDataWriter Arange Digis " << std::endl;
277 BesTofDigi* digi;
278 vector<BesTofDigi*>* vecDC = tofDC->GetVector();
279 for(int i=0;i<nDigi-1;i++)
280 for(int j=i+1;j<nDigi;j++)
281 if((*vecDC)[i]->GetTrackIndex()>(*vecDC)[j]->GetTrackIndex())
282 {
283 digi = (*vecDC)[i];
284 (*vecDC)[i] = (*vecDC)[j];
285 (*vecDC)[j] = digi;
286 }
287 //std::cout << "BesRawDataWriter Digis are arranged " << std::endl;
288
289
290 //push back tof digits to TofDigiCol in BOSS
291 for(int i=0;i<nDigi;i++)
292 {
293 //std::cout << "BesRawDataWriter Try: digi = (*tofDC)[i] " << std::endl;
294 digi = (*tofDC)[i];
295 //std::cout << "BesRawDataWriter OK: digi = (*tofDC)[i] " << std::endl;
296 G4int scinNum = digi->GetScinNb();
297 G4int barrel_ec = digi->GetPartId();
298
299
300 //std::cout << "BesRawDataWriter scinNum: "<< scinNum << std::endl;
301 //std::cout << "BesRawDataWriter barrel_ec: "<< barrel_ec << std::endl;
302 //std::cout << "BesRawDataWriter is_barrel(barrel_ec): "<<TofID::is_barrel(barrel_ec)<<std::endl;
303
304
305 //#Matthias. scinNum: 154
306 //#Matthias. barrel_ec: 1
307 //#Matthias is_barrel(barrel_ec): 1
308
309
310 unsigned int layer = 0;
311 Identifier ident;
312 unsigned int time =0;
313
314
315
316
317 if(barrel_ec == 0 || barrel_ec == 1 || barrel_ec == 2) //These numbers stand for the old TOF
318 {
319 //std::cout << "BesRawDataWriter: You are using the old TOF as TOF Detector. PartID = " << barrel_ec << std::endl;
320
321
322 if (TofID::is_barrel(barrel_ec) && scinNum > TofID::getPHI_BARREL_MAX()) {
323 layer = 1;
324 scinNum = scinNum - TofID::getPHI_BARREL_MAX() - 1;
325 }
326
327 // Store tofDigi for end==0
328 ident = TofID::cell_id ( barrel_ec, layer, scinNum, 0);
329
330 if(digi->GetForwTDC() > 0 )
332 else
333 time = 0;
334
335
336 unsigned int charge;
337
338 if(digi->GetForwADC() > 0 )
339 {
340 // ADC linear conversion
341 charge = digi->GetForwADC(); // convert ADC(pC) of bTof into Q channel in Data
342 // Treat ADC overflow
343 if(charge>=8192)
344 {
345 // The overlow flag is the 20th bit of the ADC_channel.
346 charge = (charge | 0x080000);// if ADC_channel>=8192, set overflow flag = 1.
347 // 10000000000000000000 //The 20th bit is the overflow flag
348 // 1111111111111 // =8191 -> 13 bits are required to store the information
349 // 1111110000000000000 //The time information is stored in bit 14-19, however the time is stored in an additonal indentifier, too.
350 //std::cout << "BesRawDataWriter Charge overflow ForwardADC" << std::endl;
351 }
352 charge = ( (time & 0x07e000) | charge) ; // Store tclock into ADC_channel as qclock
353 }
354 else
355 charge =0;
356
357
358 TofDigi* tofDigi = new TofDigi(ident, time, charge);
359
360 if( charge & 0x80000 ) // Treat overflow flag(20th bit)
361 {tofDigi->setOverflow(0x2);}
362
363 tofDigi->setTrackIndex(digi->GetTrackIndex());
364 aTofDigiCol->push_back(tofDigi);
365
366
367 if(barrel_ec == 0 || barrel_ec == 1 || barrel_ec == 2) //These numbers stand for the old TOF
368 {
369
370 ident = TofID::cell_id ( barrel_ec, layer, scinNum, 1);
371 if(digi->GetBackTDC()>0)
373 else
374 time = 0;
375 /*
376 G4cout << G4endl << "#Matthias charge: " << charge << G4endl;
377 G4cout << "#Matthias time " << time << G4endl;
378 G4cout << "#Matthias time /fac " << time*0.00239 << G4endl;
379 G4cout << "#Matthias (time & 0x07e000) : " << (time & 0x07e000) << G4endl;
380 G4cout << "#Matthias ( (time & 0x07e000) | charge) " << ( (time & 0x07e000) | charge) << G4endl;
381 if( charge & 0x80000 ) G4cout << "#Matthias: overflow" << G4endl;
382 if( ( (time & 0x07e000) | charge) != charge ) G4cout << "#Matthias: ungleich" << G4endl;
383 */
384 if(digi->GetBackADC()>0 )
385 {
386
387 // ADC linear conversion
388 charge = digi->GetBackADC();
389
390 // Treat ADC overflow
391 if(charge>=8192)
392 {
393 // The overlow flag is the 20th bit of the ADC_channel.
394 charge = (charge | 0x080000);// if ADC_channel>=8192, set overflow flag = 1.
395 }
396 charge = ( (time & 0x07e000) | charge) ; // Store tclock into ADC_channel as qclock
397 }
398 else
399 charge = 0;
400
401
402
403 tofDigi = new TofDigi(ident, time, charge);
404
405 if( charge & 0x80000 ) // Treat overflow flag(20th bit)
406 tofDigi->setOverflow(0x2);
407 tofDigi->setTrackIndex(digi->GetTrackIndex());
408
409 aTofDigiCol->push_back(tofDigi);
410
411
412 }//close if(barrel_ec == 0 || ...)
413
414 }//close if(barrel_ec == 0 || barrel_ec == 1 || barrel_ec == 2)
415
416
417
418 ////////////////
419 /// NewMRPC ////
420 ////////////////
421
422 else if(barrel_ec == 3 || barrel_ec == 4 || barrel_ec == 5 || barrel_ec == 6) //MRPC-Detector
423 {
424 //std::cout << "BesRawDataWriter: You are using the new MRPC as TOF Detector. PartID | scinNum " << barrel_ec << " | " << scinNum << std::endl;
425 ident = TofID::cell_id_mrpc ( barrel_ec, scinNum);
426
427
428 //static double TofTime(unsigned int timeChannel) { return ((double)timeChannel)*TOF_TIME_FACTOR; }
429 //static unsigned int TofTimeChannel (double time) { return (unsigned int)(time/TOF_TIME_FACTOR); } //Konvertiere TofTime in Zeitchannel: factor = 0.00293
430
431 if(digi->GetForwTDC() > 0 )
433 else
434 time = 0;
435
436
437
438 unsigned int time2;
439
440 if(digi->GetBackTDC() > 0 ) time2 = RawDataUtil::TofTimeChannel(digi->GetBackTDC());
441 else time2 = 0;
442
443
444
445 /*
446 std::cout << "Time1 ns " << digi->GetForwTDC() << std::endl;
447 std::cout << "Time2 ns " << digi->GetBackTDC() << std::endl;
448 std::cout << "Time1 channel " << time << std::endl;
449 std::cout << "Time2 channel " << time2 << std::endl;
450 std::cout << "charge from time2 " << exp(RawDataUtil::TofTime(time2-time)-10.)/1000. << " pC"<< std::endl;
451 */
452
453
454
455 //std::cout << "BesRawDataWriter : ident "<<ident<<std::endl;
456 //std::cout << "BesRawDataWriter : partId |time "<< barrel_ec <<" "<<time<<std::endl;
457
458
459
460
461 /* //Here I did store the charge directly, this is not done anymore as the real raw data will be to times. The difference of those time decodes the input charge!
462 unsigned int charge;
463
464 if(digi->GetForwADC() > 0 )
465 {
466 // ADC linear conversion
467 charge = digi->GetForwADC(); // convert ADC(pC) of bTof into Q channel in Data
468 //std::cout << "BesRawDataWriter :partID | charge "<< barrel_ec<<" "<<charge<<std::endl;
469
470 // Treat ADC overflow
471 if(charge>=8192)
472 {
473 // The overlow flag is the 20th bit of the ADC_channel.
474 charge = (charge | 0x080000);// if ADC_channel>=8192, set overflow flag = 1.
475 // 10000000000000000000 //The 20th bit is the overflow flag
476 // 1111111111111 // =8191 -> 13 bits are required to store the information
477 // 1111110000000000000 //The time information is stored in bit 14-19, however the time is stored in an additonal indentifier, too.
478 //std::cout << "BesRawDataWriter Charge overflow ForwardADC" << std::endl;
479 }
480 charge = ( (time & 0x07e000) | charge) ; // Store tclock into ADC_channel as qclock
481 }
482 else
483 charge =0;
484
485
486 //std::cout << "BesRawDataWriter : Ende - ident "<<ident<<std::endl;
487
488 // std::cout << "BesRawDataWriter : real - time "<<digi->GetForwTDC()<<std::endl;
489 //std::cout << "BesRawDataWriter : charge mit Zeit " <<charge<<std::endl;
490 //std::cout << "BesRawDataWriter : charge rekons " <<(charge & 0x1fff)<<std::endl;
491 //std::cout << "BesRawDataWriter : TDC - time "<<RawDataUtil::TofTimeChannel(digi->GetForwTDC())<<std::endl;
492 //std::cout << "BesRawDataWriter : ADC - charge "<<digi->GetForwADC()<<std::endl;
493 */
494
495
496 TofDigi* tofDigi = new TofDigi(ident, time, time2);
497 //std::cout << "BesRawDataWriter : TofDigi is stored "<<std::endl;
498
499 tofDigi->setTrackIndex(digi->GetTrackIndex());
500 //std::cout << "BesRawDataWriter : TofDigi: SetTrackIndex "<<std::endl;
501 aTofDigiCol->push_back(tofDigi);
502 //std::cout << "BesRawDataWriter : TofDigi: Pushback "<<std::endl;
503
504
505
506 }
507
508
509
510
511
512
513
514
515
516
517
518 }//close for
519 } //close if(nDigi>0)
520 } //close if(tofDigiCollID>=0)
521
522 //register TOF digits collection to TDS
523 StatusCode scTof = m_evtSvc->registerObject("/Event/Digi/TofDigiCol", aTofDigiCol);
524 if(scTof!=StatusCode::SUCCESS)
525 G4cout<< "Could not register TOF digi collection" <<G4endl;
526
527 //std::cout << "BesRawDataWriter : TOF digi colleceton is registered! "<<std::endl;
528
529
530 //retrieve TOF digits from TDS
531 /*SmartDataPtr<TofDigiCol> aDigiCol(m_evtSvc,"/Event/Digi/TofDigiCol");
532 if(!aDigiCol)
533 G4cout<<"Could not retrieve TOF digi collection"<<G4endl;
534
535 TofDigiCol::iterator iDigiCol;
536 for(iDigiCol=aDigiCol->begin(); iDigiCol!=aDigiCol->end(); iDigiCol++)
537 {
538 const Identifier ident = (*iDigiCol)->identify();
539 G4cout<<"partId: "<<TofID::barrel_ec(ident);
540 G4cout<<" layer: "<<TofID::layer(ident);
541 G4cout<<" scinNb: "<<TofID::phi_module(ident);
542 // G4cout<<" end: "<<TofID::end(ident);
543 G4cout<<" charge: "<<(*iDigiCol)->getChargeChannel();
544 G4cout<<" time: "<<(*iDigiCol)->getTimeChannel()<<G4endl;
545 }
546 G4cout<<"end of retrieve TOF digits"<<G4endl;
547 */
548}
549
551{
552 //Emc digits collection defined in BOSS
553 EmcDigiCol* aEmcDigiCol = new EmcDigiCol;
554
555 G4int emcDigiCollID = -1;
556 emcDigiCollID = m_DigiMan->GetDigiCollectionID("BesEmcDigitsCollection");
557 if(emcDigiCollID>=0)
558 {
559 BesEmcDigitsCollection* emcDC = (BesEmcDigitsCollection*)m_DigiMan->GetDigiCollection(emcDigiCollID);
560 G4int nDigi = emcDC->entries();
561 if(nDigi>0)
562 {
563 //arrange digis in digitsCollection in order of trackIndex
564 BesEmcDigi* digi;
565 vector<BesEmcDigi*>* vecDC = emcDC->GetVector();
566 for(int i=0;i<nDigi-1;i++)
567 for(int j=i+1;j<nDigi;j++)
568 if((*vecDC)[i]->GetTrackIndex()>(*vecDC)[j]->GetTrackIndex())
569 {
570 digi = (*vecDC)[i];
571 (*vecDC)[i] = (*vecDC)[j];
572 (*vecDC)[j] = digi;
573 }
574 //push back EmcDigi to EmcDigiCol in BOSS
575 for(int i=0;i<nDigi;i++)
576 {
577 digi = (*emcDC)[i];
578
579 int charge = RawDataUtil::EmcChargeChannel(digi->GetEnergy());
580 int measure = RawDataUtil::EmcChargeMeasure(digi->GetEnergy());
582 Identifier ident = EmcID::crystal_id (digi->GetPartId(), digi->GetThetaNb(), digi->GetPhiNb());
583 EmcDigi* emcDigi = new EmcDigi(ident, time, charge);
584 emcDigi->setTrackIndex(digi->GetTrackIndex());
585 emcDigi->setMeasure(measure);
586 aEmcDigiCol->push_back(emcDigi);
587 }
588 }
589 }
590
591 //register EMC digits collection to TDS
592 StatusCode scEmc = m_evtSvc->registerObject("/Event/Digi/EmcDigiCol", aEmcDigiCol);
593 if(scEmc!=StatusCode::SUCCESS)
594 G4cout<< "Could not register EMC digi collection" <<G4endl;
595
596 //retrieve EMC digits from TDS
597 /*SmartDataPtr<EmcDigiCol> aDigiCol(m_evtSvc,"/Event/Digi/EmcDigiCol");
598 if(!aDigiCol)
599 G4cout<<"Could not retrieve EMC digi collection"<<G4endl;
600
601 EmcDigiCol::iterator iDigiCol;
602 for(iDigiCol=aDigiCol->begin(); iDigiCol!=aDigiCol->end(); iDigiCol++)
603 {
604 const Identifier ident = (*iDigiCol)->identify();
605 G4cout<<"barrel_ec: "<<EmcID::barrel_ec(ident);
606 G4cout<<" theta: "<<EmcID::theta_module(ident);
607 G4cout<<" phi: "<<EmcID::phi_module(ident);
608 G4cout<<" charge: "<<(*iDigiCol)->getChargeChannel();
609 G4cout<<" time: "<<(*iDigiCol)->getTimeChannel()<<G4endl;
610 }
611 G4cout<<"end of retrieve EMC digits"<<G4endl;
612 */
613}
614
616{
617 //Muc digits collection defined in BOSS
618 MucDigiCol* aMucDigiCol = new MucDigiCol;
619
620 G4int mucDigiCollID =-1;
621 mucDigiCollID = m_DigiMan->GetDigiCollectionID("BesMucDigisCollection");
622 if(mucDigiCollID>=0)
623 {
624 BesMucDigisCollection* mucDC = (BesMucDigisCollection*)m_DigiMan->GetDigiCollection(mucDigiCollID);
625 G4int nDigi = mucDC->entries();
626
627 if(nDigi > 0) {
628 BesMucDigi* digi;
629 for(int i = 0; i < nDigi; i++) {
630 digi = (*mucDC)[i];
631 Identifier ident = MucID::channel_id( digi->GetPartId(), digi->GetSegId(),digi->GetGapId(),digi->GetStripId() );
632 MucDigi* mucDigi = new MucDigi(ident);
633 mucDigi->setTrackIndex(digi->GetTrackIndex());
634 aMucDigiCol->push_back(mucDigi);
635 }
636 }
637 }
638
639 //register MUC digits collection to TDS
640 StatusCode scMuc = m_evtSvc->registerObject("/Event/Digi/MucDigiCol", aMucDigiCol);
641 if(scMuc!=StatusCode::SUCCESS)
642 G4cout<< "Could not register MUC digi collection" <<G4endl;
643
644 //retrieve MUC digits from TDS
645 /*SmartDataPtr<MucDigiCol> aDigiCol(m_evtSvc,"/Event/Digi/MucDigiCol");
646 if(!aDigiCol)
647 G4cout<<"Could not retrieve MUC digi collection"<<G4endl;
648
649 MucDigiCol::iterator iDigiCol;
650 for(iDigiCol=aDigiCol->begin(); iDigiCol!=aDigiCol->end(); iDigiCol++)
651 {
652 const Identifier ident = (*iDigiCol)->identify();
653 G4cout<<"Part: "<<MucID::part(ident);
654 G4cout<<" Seg: "<<MucID::seg(ident);
655 G4cout<<" Gap: "<<MucID::gap(ident);
656 G4cout<<" Strip: "<<MucID::strip(ident)<<G4endl;
657 }
658 G4cout<<"end of retrieve MUC digits"<<G4endl;
659 */
660}
Double_t time
G4TDigiCollection< BesCgemDigi > BesCgemDigisCollection
G4TDigiCollection< BesEmcDigi > BesEmcDigitsCollection
ObjectVector< MdcDigi > MdcDigiCol
G4TDigiCollection< BesMdcDigi > BesMdcDigisCollection
ObjectVector< MucDigi > MucDigiCol
G4TDigiCollection< BesMucDigi > BesMucDigisCollection
ObjectVector< TofDigi > TofDigiCol
G4TDigiCollection< BesTofDigi > BesTofDigitsCollection
static BesMdcGeoParameter * GetGeo(void)
static int strip(const Identifier &id)
static int sheet(const Identifier &id)
static int layer(const Identifier &id)
static bool is_xstrip(const Identifier &id)
static Identifier strip_id(int f_layer, int f_sheet, int f_strip_type, int f_strip)
void setMeasure(const unsigned int measure)
static Identifier crystal_id(const unsigned int barrel_ec, const unsigned int theta_module, const unsigned int phi_module)
For a single crystal.
static Identifier wire_id(int wireType, int layer, int wire)
For a single wire.
static Identifier channel_id(int barrel_ec, int segment, int layer, int channel)
For a single crystal.
static unsigned int TofTimeChannel(double time)
void setTrackIndex(const int trackIndex)
Definition: RawData.cxx:35
void setOverflow(const unsigned int overflow)
static Identifier cell_id(int barrel_ec, int layer, int phi_module, int end)
For a single crystal.
static value_type getPHI_BARREL_MAX()
static bool is_barrel(const Identifier &id)
Test for barrel.
static Identifier cell_id_mrpc(int partID, int scinNum)