CGEM BOSS 6.6.5.g
BESIII Offline Software System
Loading...
Searching...
No Matches
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"
30#include "TofRawEvent/TofDigi.h"
31#include "EmcRawEvent/EmcDigi.h"
32#include "MucRawEvent/MucDigi.h"
33
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
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 double Q_in_fC=cgemDigi->GetEnergyDeposit();
208 double T_in_ns=cgemDigi->GetGlobalTime();
209 if(printFlag)
210 G4cout << "digiID=" << ident.get_value()
211 << " layerID=" << CgemID::layer(ident)
212 << " sheetID=" << CgemID::sheet(ident)
213 << " isXstrip=" << CgemID::is_xstrip(ident)
214 << " stripID=" << CgemID::strip(ident)
215 << " time=" << time
216 << " charge=" << charge //<< G4endl;
217 << " time_ns=" << T_in_ns
218 << " charge_fc=" << Q_in_fC << G4endl;
219
220 CgemDigi* aCgemDigi = new CgemDigi(ident, time, charge);
221 aCgemDigi->setTrackIndex(cgemDigi->GetTrackID());
222
223 aCgemDigi->setCharge_fc(Q_in_fC);
224 aCgemDigi->setTime_ns(T_in_ns);
225
226 aCgemDigiCol->push_back(aCgemDigi);
227
228 } /* End of 'for(int i=0;i<nDigi;i++)' */
229 } /* End of 'if (nDigi > 0)' */
230 } /* End of 'if (cgemDigiCollID >= 0)' */
231
232 /* register CGEM digits collection to TDS */
233 StatusCode scCgem = m_evtSvc->registerObject("/Event/Digi/CgemDigiCol", aCgemDigiCol);
234 if(scCgem!=StatusCode::SUCCESS)
235 {
236 G4cout << "ERROR : BesSim::BesRawDataWriter::SaveCgemDigits(), Could not register CGEM digi collection! " << G4endl;
237 }
238
239
240 //std::cout<<__FILE__<<" "<<__LINE__<<std::endl;
241 //CgemDigiCol::iterator iter = aCgemDigiCol->begin();
242 //for ( ; iter != aCgemDigiCol->end(); iter++)
243 //{
244 // std::cout << " layer " << CgemID::layer((*iter)->identify())
245 // << " sheet " << CgemID::sheet((*iter)->identify())
246 // << " time " << (*iter)->getTimeChannel()
247 // << " charge " << (*iter)->getChargeChannel() << std::endl;
248 //}
249
250 //retrieve CGEM digits from TDS
251 /*SmartDataPtr<CgemDigiCol> aDigiCol(m_evtSvc,"/Event/Digi/CgemDigiCol");
252 if(!aDigiCol)
253 G4cout<<"Could not retrieve CGEM digi collection"<<G4endl;
254
255 CgemDigiCol::iterator iDigiCol;
256 for(iDigiCol=aDigiCol->begin(); iDigiCol!=aDigiCol->end(); iDigiCol++)
257 {
258 const Identifier ident = (*iDigiCol)->identify();
259 G4cout<<"layer: "<<CgemID::layer(ident);
260 G4cout<<" cell: "<<CgemID::wire(ident);
261 G4cout<<" charge: "<<(*iDigiCol)->getChargeChannel();
262 G4cout<<" time: "<<(*iDigiCol)->getTimeChannel()<<G4endl;
263 }
264 G4cout<<"end of retrieve CGEM digi collection"<<G4endl;
265 */
266}
267
269{
270 //Tof digits collection defined in BOSS
271 TofDigiCol* aTofDigiCol = new TofDigiCol;
272
273 G4int tofDigiCollID = -1;
274 tofDigiCollID = m_DigiMan->GetDigiCollectionID("BesTofDigitsCollection");
275
276 if(tofDigiCollID>=0)
277 {
278 BesTofDigitsCollection* tofDC = (BesTofDigitsCollection*)m_DigiMan->GetDigiCollection(tofDigiCollID);
279 G4int nDigi = tofDC->entries();
280 if(nDigi>0)
281 {
282 //arrange digis in digitsCollection in order of trackIndex
283
284 //std::cout << "BesRawDataWriter Arange Digis " << std::endl;
285 BesTofDigi* digi;
286 vector<BesTofDigi*>* vecDC = tofDC->GetVector();
287 for(int i=0;i<nDigi-1;i++)
288 for(int j=i+1;j<nDigi;j++)
289 if((*vecDC)[i]->GetTrackIndex()>(*vecDC)[j]->GetTrackIndex())
290 {
291 digi = (*vecDC)[i];
292 (*vecDC)[i] = (*vecDC)[j];
293 (*vecDC)[j] = digi;
294 }
295 //std::cout << "BesRawDataWriter Digis are arranged " << std::endl;
296
297
298 //push back tof digits to TofDigiCol in BOSS
299 for(int i=0;i<nDigi;i++)
300 {
301 //std::cout << "BesRawDataWriter Try: digi = (*tofDC)[i] " << std::endl;
302 digi = (*tofDC)[i];
303 //std::cout << "BesRawDataWriter OK: digi = (*tofDC)[i] " << std::endl;
304 G4int scinNum = digi->GetScinNb();
305 G4int barrel_ec = digi->GetPartId();
306
307
308 //std::cout << "BesRawDataWriter scinNum: "<< scinNum << std::endl;
309 //std::cout << "BesRawDataWriter barrel_ec: "<< barrel_ec << std::endl;
310 //std::cout << "BesRawDataWriter is_barrel(barrel_ec): "<<TofID::is_barrel(barrel_ec)<<std::endl;
311
312
313 //#Matthias. scinNum: 154
314 //#Matthias. barrel_ec: 1
315 //#Matthias is_barrel(barrel_ec): 1
316
317
318 unsigned int layer = 0;
319 Identifier ident;
320 unsigned int time =0;
321
322
323
324
325 if(barrel_ec == 0 || barrel_ec == 1 || barrel_ec == 2) //These numbers stand for the old TOF
326 {
327 //std::cout << "BesRawDataWriter: You are using the old TOF as TOF Detector. PartID = " << barrel_ec << std::endl;
328
329
330 if (TofID::is_barrel(barrel_ec) && scinNum > TofID::getPHI_BARREL_MAX()) {
331 layer = 1;
332 scinNum = scinNum - TofID::getPHI_BARREL_MAX() - 1;
333 }
334
335 // Store tofDigi for end==0
336 ident = TofID::cell_id ( barrel_ec, layer, scinNum, 0);
337
338 if(digi->GetForwTDC() > 0 )
340 else
341 time = 0;
342
343
344 unsigned int charge;
345
346 if(digi->GetForwADC() > 0 )
347 {
348 // ADC linear conversion
349 charge = digi->GetForwADC(); // convert ADC(pC) of bTof into Q channel in Data
350 // Treat ADC overflow
351 if(charge>=8192)
352 {
353 // The overlow flag is the 20th bit of the ADC_channel.
354 charge = (charge | 0x080000);// if ADC_channel>=8192, set overflow flag = 1.
355 // 10000000000000000000 //The 20th bit is the overflow flag
356 // 1111111111111 // =8191 -> 13 bits are required to store the information
357 // 1111110000000000000 //The time information is stored in bit 14-19, however the time is stored in an additonal indentifier, too.
358 //std::cout << "BesRawDataWriter Charge overflow ForwardADC" << std::endl;
359 }
360 charge = ( (time & 0x07e000) | charge) ; // Store tclock into ADC_channel as qclock
361 }
362 else
363 charge =0;
364
365
366 TofDigi* tofDigi = new TofDigi(ident, time, charge);
367
368 if( charge & 0x80000 ) // Treat overflow flag(20th bit)
369 {tofDigi->setOverflow(0x2);}
370
371 tofDigi->setTrackIndex(digi->GetTrackIndex());
372 aTofDigiCol->push_back(tofDigi);
373
374
375 if(barrel_ec == 0 || barrel_ec == 1 || barrel_ec == 2) //These numbers stand for the old TOF
376 {
377
378 ident = TofID::cell_id ( barrel_ec, layer, scinNum, 1);
379 if(digi->GetBackTDC()>0)
381 else
382 time = 0;
383 /*
384 G4cout << G4endl << "#Matthias charge: " << charge << G4endl;
385 G4cout << "#Matthias time " << time << G4endl;
386 G4cout << "#Matthias time /fac " << time*0.00239 << G4endl;
387 G4cout << "#Matthias (time & 0x07e000) : " << (time & 0x07e000) << G4endl;
388 G4cout << "#Matthias ( (time & 0x07e000) | charge) " << ( (time & 0x07e000) | charge) << G4endl;
389 if( charge & 0x80000 ) G4cout << "#Matthias: overflow" << G4endl;
390 if( ( (time & 0x07e000) | charge) != charge ) G4cout << "#Matthias: ungleich" << G4endl;
391 */
392 if(digi->GetBackADC()>0 )
393 {
394
395 // ADC linear conversion
396 charge = digi->GetBackADC();
397
398 // Treat ADC overflow
399 if(charge>=8192)
400 {
401 // The overlow flag is the 20th bit of the ADC_channel.
402 charge = (charge | 0x080000);// if ADC_channel>=8192, set overflow flag = 1.
403 }
404 charge = ( (time & 0x07e000) | charge) ; // Store tclock into ADC_channel as qclock
405 }
406 else
407 charge = 0;
408
409
410
411 tofDigi = new TofDigi(ident, time, charge);
412
413 if( charge & 0x80000 ) // Treat overflow flag(20th bit)
414 tofDigi->setOverflow(0x2);
415 tofDigi->setTrackIndex(digi->GetTrackIndex());
416
417 aTofDigiCol->push_back(tofDigi);
418
419
420 }//close if(barrel_ec == 0 || ...)
421
422 }//close if(barrel_ec == 0 || barrel_ec == 1 || barrel_ec == 2)
423
424
425
426 ////////////////
427 /// NewMRPC ////
428 ////////////////
429
430 else if(barrel_ec == 3 || barrel_ec == 4 || barrel_ec == 5 || barrel_ec == 6) //MRPC-Detector
431 {
432 //std::cout << "BesRawDataWriter: You are using the new MRPC as TOF Detector. PartID | scinNum " << barrel_ec << " | " << scinNum << std::endl;
433 ident = TofID::cell_id_mrpc ( barrel_ec, scinNum);
434
435
436 //static double TofTime(unsigned int timeChannel) { return ((double)timeChannel)*TOF_TIME_FACTOR; }
437 //static unsigned int TofTimeChannel (double time) { return (unsigned int)(time/TOF_TIME_FACTOR); } //Konvertiere TofTime in Zeitchannel: factor = 0.00293
438
439 if(digi->GetForwTDC() > 0 )
441 else
442 time = 0;
443
444
445
446 unsigned int time2;
447
448 if(digi->GetBackTDC() > 0 ) time2 = RawDataUtil::TofTimeChannel(digi->GetBackTDC());
449 else time2 = 0;
450
451
452
453 /*
454 std::cout << "Time1 ns " << digi->GetForwTDC() << std::endl;
455 std::cout << "Time2 ns " << digi->GetBackTDC() << std::endl;
456 std::cout << "Time1 channel " << time << std::endl;
457 std::cout << "Time2 channel " << time2 << std::endl;
458 std::cout << "charge from time2 " << exp(RawDataUtil::TofTime(time2-time)-10.)/1000. << " pC"<< std::endl;
459 */
460
461
462
463 //std::cout << "BesRawDataWriter : ident "<<ident<<std::endl;
464 //std::cout << "BesRawDataWriter : partId |time "<< barrel_ec <<" "<<time<<std::endl;
465
466
467
468
469 /* //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!
470 unsigned int charge;
471
472 if(digi->GetForwADC() > 0 )
473 {
474 // ADC linear conversion
475 charge = digi->GetForwADC(); // convert ADC(pC) of bTof into Q channel in Data
476 //std::cout << "BesRawDataWriter :partID | charge "<< barrel_ec<<" "<<charge<<std::endl;
477
478 // Treat ADC overflow
479 if(charge>=8192)
480 {
481 // The overlow flag is the 20th bit of the ADC_channel.
482 charge = (charge | 0x080000);// if ADC_channel>=8192, set overflow flag = 1.
483 // 10000000000000000000 //The 20th bit is the overflow flag
484 // 1111111111111 // =8191 -> 13 bits are required to store the information
485 // 1111110000000000000 //The time information is stored in bit 14-19, however the time is stored in an additonal indentifier, too.
486 //std::cout << "BesRawDataWriter Charge overflow ForwardADC" << std::endl;
487 }
488 charge = ( (time & 0x07e000) | charge) ; // Store tclock into ADC_channel as qclock
489 }
490 else
491 charge =0;
492
493
494 //std::cout << "BesRawDataWriter : Ende - ident "<<ident<<std::endl;
495
496 // std::cout << "BesRawDataWriter : real - time "<<digi->GetForwTDC()<<std::endl;
497 //std::cout << "BesRawDataWriter : charge mit Zeit " <<charge<<std::endl;
498 //std::cout << "BesRawDataWriter : charge rekons " <<(charge & 0x1fff)<<std::endl;
499 //std::cout << "BesRawDataWriter : TDC - time "<<RawDataUtil::TofTimeChannel(digi->GetForwTDC())<<std::endl;
500 //std::cout << "BesRawDataWriter : ADC - charge "<<digi->GetForwADC()<<std::endl;
501 */
502
503
504 TofDigi* tofDigi = new TofDigi(ident, time, time2);
505 //std::cout << "BesRawDataWriter : TofDigi is stored "<<std::endl;
506
507 tofDigi->setTrackIndex(digi->GetTrackIndex());
508 //std::cout << "BesRawDataWriter : TofDigi: SetTrackIndex "<<std::endl;
509 aTofDigiCol->push_back(tofDigi);
510 //std::cout << "BesRawDataWriter : TofDigi: Pushback "<<std::endl;
511
512
513
514 }
515
516
517
518
519
520
521
522
523
524
525
526 }//close for
527 } //close if(nDigi>0)
528 } //close if(tofDigiCollID>=0)
529
530 //register TOF digits collection to TDS
531 StatusCode scTof = m_evtSvc->registerObject("/Event/Digi/TofDigiCol", aTofDigiCol);
532 if(scTof!=StatusCode::SUCCESS)
533 G4cout<< "Could not register TOF digi collection" <<G4endl;
534
535 //std::cout << "BesRawDataWriter : TOF digi colleceton is registered! "<<std::endl;
536
537
538 //retrieve TOF digits from TDS
539 /*SmartDataPtr<TofDigiCol> aDigiCol(m_evtSvc,"/Event/Digi/TofDigiCol");
540 if(!aDigiCol)
541 G4cout<<"Could not retrieve TOF digi collection"<<G4endl;
542
543 TofDigiCol::iterator iDigiCol;
544 for(iDigiCol=aDigiCol->begin(); iDigiCol!=aDigiCol->end(); iDigiCol++)
545 {
546 const Identifier ident = (*iDigiCol)->identify();
547 G4cout<<"partId: "<<TofID::barrel_ec(ident);
548 G4cout<<" layer: "<<TofID::layer(ident);
549 G4cout<<" scinNb: "<<TofID::phi_module(ident);
550 // G4cout<<" end: "<<TofID::end(ident);
551 G4cout<<" charge: "<<(*iDigiCol)->getChargeChannel();
552 G4cout<<" time: "<<(*iDigiCol)->getTimeChannel()<<G4endl;
553 }
554 G4cout<<"end of retrieve TOF digits"<<G4endl;
555 */
556}
557
559{
560 //Emc digits collection defined in BOSS
561 EmcDigiCol* aEmcDigiCol = new EmcDigiCol;
562
563 G4int emcDigiCollID = -1;
564 emcDigiCollID = m_DigiMan->GetDigiCollectionID("BesEmcDigitsCollection");
565 if(emcDigiCollID>=0)
566 {
567 BesEmcDigitsCollection* emcDC = (BesEmcDigitsCollection*)m_DigiMan->GetDigiCollection(emcDigiCollID);
568 G4int nDigi = emcDC->entries();
569 if(nDigi>0)
570 {
571 //arrange digis in digitsCollection in order of trackIndex
572 BesEmcDigi* digi;
573 vector<BesEmcDigi*>* vecDC = emcDC->GetVector();
574 for(int i=0;i<nDigi-1;i++)
575 for(int j=i+1;j<nDigi;j++)
576 if((*vecDC)[i]->GetTrackIndex()>(*vecDC)[j]->GetTrackIndex())
577 {
578 digi = (*vecDC)[i];
579 (*vecDC)[i] = (*vecDC)[j];
580 (*vecDC)[j] = digi;
581 }
582 //push back EmcDigi to EmcDigiCol in BOSS
583 for(int i=0;i<nDigi;i++)
584 {
585 digi = (*emcDC)[i];
586
587 int charge = RawDataUtil::EmcChargeChannel(digi->GetEnergy());
588 int measure = RawDataUtil::EmcChargeMeasure(digi->GetEnergy());
590 Identifier ident = EmcID::crystal_id (digi->GetPartId(), digi->GetThetaNb(), digi->GetPhiNb());
591 EmcDigi* emcDigi = new EmcDigi(ident, time, charge);
592 emcDigi->setTrackIndex(digi->GetTrackIndex());
593 emcDigi->setMeasure(measure);
594 aEmcDigiCol->push_back(emcDigi);
595 }
596 }
597 }
598
599 //register EMC digits collection to TDS
600 StatusCode scEmc = m_evtSvc->registerObject("/Event/Digi/EmcDigiCol", aEmcDigiCol);
601 if(scEmc!=StatusCode::SUCCESS)
602 G4cout<< "Could not register EMC digi collection" <<G4endl;
603
604 //retrieve EMC digits from TDS
605 /*SmartDataPtr<EmcDigiCol> aDigiCol(m_evtSvc,"/Event/Digi/EmcDigiCol");
606 if(!aDigiCol)
607 G4cout<<"Could not retrieve EMC digi collection"<<G4endl;
608
609 EmcDigiCol::iterator iDigiCol;
610 for(iDigiCol=aDigiCol->begin(); iDigiCol!=aDigiCol->end(); iDigiCol++)
611 {
612 const Identifier ident = (*iDigiCol)->identify();
613 G4cout<<"barrel_ec: "<<EmcID::barrel_ec(ident);
614 G4cout<<" theta: "<<EmcID::theta_module(ident);
615 G4cout<<" phi: "<<EmcID::phi_module(ident);
616 G4cout<<" charge: "<<(*iDigiCol)->getChargeChannel();
617 G4cout<<" time: "<<(*iDigiCol)->getTimeChannel()<<G4endl;
618 }
619 G4cout<<"end of retrieve EMC digits"<<G4endl;
620 */
621}
622
624{
625 //Muc digits collection defined in BOSS
626 MucDigiCol* aMucDigiCol = new MucDigiCol;
627
628 G4int mucDigiCollID =-1;
629 mucDigiCollID = m_DigiMan->GetDigiCollectionID("BesMucDigisCollection");
630 if(mucDigiCollID>=0)
631 {
632 BesMucDigisCollection* mucDC = (BesMucDigisCollection*)m_DigiMan->GetDigiCollection(mucDigiCollID);
633 G4int nDigi = mucDC->entries();
634
635 if(nDigi > 0) {
636 BesMucDigi* digi;
637 for(int i = 0; i < nDigi; i++) {
638 digi = (*mucDC)[i];
639 Identifier ident = MucID::channel_id( digi->GetPartId(), digi->GetSegId(),digi->GetGapId(),digi->GetStripId() );
640 MucDigi* mucDigi = new MucDigi(ident);
641 mucDigi->setTrackIndex(digi->GetTrackIndex());
642 aMucDigiCol->push_back(mucDigi);
643 }
644 }
645 }
646
647 //register MUC digits collection to TDS
648 StatusCode scMuc = m_evtSvc->registerObject("/Event/Digi/MucDigiCol", aMucDigiCol);
649 if(scMuc!=StatusCode::SUCCESS)
650 G4cout<< "Could not register MUC digi collection" <<G4endl;
651
652 //retrieve MUC digits from TDS
653 /*SmartDataPtr<MucDigiCol> aDigiCol(m_evtSvc,"/Event/Digi/MucDigiCol");
654 if(!aDigiCol)
655 G4cout<<"Could not retrieve MUC digi collection"<<G4endl;
656
657 MucDigiCol::iterator iDigiCol;
658 for(iDigiCol=aDigiCol->begin(); iDigiCol!=aDigiCol->end(); iDigiCol++)
659 {
660 const Identifier ident = (*iDigiCol)->identify();
661 G4cout<<"Part: "<<MucID::part(ident);
662 G4cout<<" Seg: "<<MucID::seg(ident);
663 G4cout<<" Gap: "<<MucID::gap(ident);
664 G4cout<<" Strip: "<<MucID::strip(ident)<<G4endl;
665 }
666 G4cout<<"end of retrieve MUC digits"<<G4endl;
667 */
668}
G4TDigiCollection< BesCgemDigi > BesCgemDigisCollection
Definition: BesCgemDigi.hh:91
G4TDigiCollection< BesEmcDigi > BesEmcDigitsCollection
Definition: BesEmcDigi.hh:69
G4TDigiCollection< BesMdcDigi > BesMdcDigisCollection
Definition: BesMdcDigi.hh:59
G4TDigiCollection< BesMucDigi > BesMucDigisCollection
Definition: BesMucDigi.hh:56
G4TDigiCollection< BesTofDigi > BesTofDigitsCollection
Definition: BesTofDigi.hh:83
ObjectVector< CgemDigi > CgemDigiCol
Definition: CgemDigi.h:43
Double_t time
ObjectVector< EmcDigi > EmcDigiCol
Definition: EmcDigi.h:43
ObjectVector< MdcDigi > MdcDigiCol
Definition: MdcDigi.h:39
ObjectVector< MucDigi > MucDigiCol
Definition: MucDigi.h:29
ObjectVector< TofDigi > TofDigiCol
Definition: TofDigi.h:41
G4int GetSheetID() const
Definition: BesCgemDigi.hh:74
G4double GetGlobalTime() const
Definition: BesCgemDigi.hh:78
G4double GetEnergyDeposit() const
Definition: BesCgemDigi.hh:77
G4int GetStripType() const
Definition: BesCgemDigi.hh:75
G4int GetLayerID() const
Definition: BesCgemDigi.hh:73
G4int GetStripID() const
Definition: BesCgemDigi.hh:76
G4int GetTrackID() const
Definition: BesCgemDigi.hh:72
G4int GetTrackIndex()
Definition: BesEmcDigi.hh:54
G4int GetThetaNb()
Definition: BesEmcDigi.hh:50
G4double GetEnergy()
Definition: BesEmcDigi.hh:52
G4int GetPhiNb()
Definition: BesEmcDigi.hh:51
G4double GetTime()
Definition: BesEmcDigi.hh:53
G4int GetPartId()
Definition: BesEmcDigi.hh:49
G4int GetLayerNo()
Definition: BesMdcDigi.hh:44
G4double GetEdep()
Definition: BesMdcDigi.hh:46
G4int GetCellNo()
Definition: BesMdcDigi.hh:45
G4int GetTrackID()
Definition: BesMdcDigi.hh:43
G4double GetDriftT()
Definition: BesMdcDigi.hh:47
static BesMdcGeoParameter * GetGeo(void)
G4int GetPartId()
Definition: BesMucDigi.hh:43
G4int GetStripId()
Definition: BesMucDigi.hh:46
G4int GetSegId()
Definition: BesMucDigi.hh:44
G4int GetTrackIndex()
Definition: BesMucDigi.hh:42
G4int GetGapId()
Definition: BesMucDigi.hh:45
G4int GetPartId()
Definition: BesTofDigi.hh:55
G4double GetForwTDC()
Definition: BesTofDigi.hh:59
G4int GetScinNb()
Definition: BesTofDigi.hh:56
G4int GetTrackIndex()
Definition: BesTofDigi.hh:54
G4double GetBackTDC()
Definition: BesTofDigi.hh:60
G4double GetBackADC()
Definition: BesTofDigi.hh:58
G4double GetForwADC()
Definition: BesTofDigi.hh:57
void setCharge_fc(double q)
Definition: CgemDigi.h:33
void setTime_ns(double t)
Definition: CgemDigi.h:32
static int strip(const Identifier &id)
Definition: CgemID.cxx:83
static int sheet(const Identifier &id)
Definition: CgemID.cxx:77
static int layer(const Identifier &id)
Definition: CgemID.cxx:71
static bool is_xstrip(const Identifier &id)
Definition: CgemID.cxx:64
static Identifier strip_id(int f_layer, int f_sheet, int f_strip_type, int f_strip)
Definition: CgemID.cxx:89
void setMeasure(const unsigned int measure)
Definition: EmcDigi.h:24
static Identifier crystal_id(const unsigned int barrel_ec, const unsigned int theta_module, const unsigned int phi_module)
For a single crystal.
Definition: EmcID.cxx:71
Definition: G4Svc.h:32
int GetMdcDedxFlag()
Definition: G4Svc.h:94
double GetCgemStripEff()
Definition: G4Svc.h:95
int GetCgemDedxFlag()
Definition: G4Svc.h:102
Definition: IG4Svc.h:30
value_type get_value() const
Definition: Identifier.h:163
static Identifier wire_id(int wireType, int layer, int wire)
For a single wire.
Definition: MdcID.cxx:77
static Identifier channel_id(int barrel_ec, int segment, int layer, int channel)
For a single crystal.
Definition: MucID.cxx:135
static int EmcChargeChannel(double charge)
Definition: RawDataUtil.h:43
static int CgemTimeChannel(double time)
Definition: RawDataUtil.h:15
static int MdcTimeChannel(double time)
Definition: RawDataUtil.h:9
static int EmcChargeMeasure(double charge)
Definition: RawDataUtil.h:56
static int MdcChargeChannel(double charge)
Definition: RawDataUtil.h:12
static unsigned int TofTimeChannel(double time)
Definition: RawDataUtil.h:70
static int EmcTimeChannel(double time)
Definition: RawDataUtil.h:21
static int CgemChargeChannel(double charge)
Definition: RawDataUtil.h:18
void setTrackIndex(const int trackIndex)
Definition: RawData.cxx:35
void setOverflow(const unsigned int overflow)
Definition: TofDigi.h:23
static Identifier cell_id(int barrel_ec, int layer, int phi_module, int end)
For a single crystal.
Definition: TofID.cxx:156
static value_type getPHI_BARREL_MAX()
Definition: TofID.cxx:237
static bool is_barrel(const Identifier &id)
Test for barrel.
Definition: TofID.cxx:78
static Identifier cell_id_mrpc(int partID, int scinNum)
Definition: TofID.cxx:177