CGEM BOSS 6.6.5.i
BESIII Offline Software System
Loading...
Searching...
No Matches
TofShower Class Reference

#include <TofShower.h>

Public Member Functions

 TofShower ()
 
 ~TofShower ()
 
vector< IdentifiergetNeighbors (const Identifier &id)
 
vector< IdentifiergetNextNeighbors (const Identifier &id)
 
vector< IdentifiergetMRPC_neighbours (const Identifier &id)
 
int get_mrpc_partid_neighbour (string which, int stripid, int layer)
 
int get_mrpc_stripid_neighbour (string which, int stripid, int layer)
 
void energyCalib (vector< TofData * > &tofDataVec, RecTofTrackCol *recTofTrackCol)
 
void findSeed (vector< TofData * > &tofDataVec)
 
void findShower (vector< TofData * > &tofDataVec, RecTofTrackCol *recTofTrackCol, double)
 
void BookNtuple (NTuple::Tuple *&tuple, NTuple::Tuple *&tuple1, NTuple::Tuple *&tuple2)
 
void readCalibPar ()
 
double ecalib (const int nsci) const
 
void setEcalib (const int nsci, const double ecalib)
 
double calib (const int n, const int m) const
 
void setCalib (const int n, const int m, const double ecalib)
 
double calibConst () const
 
void setCalibConst (const double cal)
 
bool isData () const
 
void setIsData (const bool isData)
 

Detailed Description

Definition at line 25 of file TofShower.h.

Constructor & Destructor Documentation

◆ TofShower()

TofShower::TofShower ( )

Definition at line 28 of file TofShower.cxx.

28 :m_output(false),m_isData(true) // m_output wird auf false und m_isData auf true gesetzt
29{
30 IJobOptionsSvc* jobSvc;
31 Gaudi::svcLocator()->service("JobOptionsSvc", jobSvc);
32 jobSvc->setMyProperties("TofShower", &m_propMgr);
33
34}

◆ ~TofShower()

TofShower::~TofShower ( )
inline

Definition at line 28 of file TofShower.h.

28{;}

Member Function Documentation

◆ BookNtuple()

void TofShower::BookNtuple ( NTuple::Tuple *& tuple,
NTuple::Tuple *& tuple1,
NTuple::Tuple *& tuple2 )

Definition at line 36 of file TofShower.cxx.

37{
38 m_output = true;
39 m_tuple = tuple;
40 if(!m_tuple) {
41 std::cerr << "Invalid ntuple in TofEnergyRec!" << std::endl;
42 } else {
43 m_tuple->addItem ("part", m_part);
44 m_tuple->addItem ("layer", m_layer);
45 m_tuple->addItem ("im", m_im);
46 m_tuple->addItem ("end", m_end);
47 m_tuple->addItem ("zpos", m_zpos);
48 m_tuple->addItem ("adc1", m_adc1);
49 m_tuple->addItem ("adc2", m_adc2);
50 m_tuple->addItem ("tdc1", m_tdc1);
51 m_tuple->addItem ("tdc2", m_tdc2);
52 m_tuple->addItem ("energy", m_energy);
53 }
54
55 m_tuple1 = tuple1;
56 if(!m_tuple1) {
57 std::cerr << "Invalid ntuple1 in TofEnergyRec!" << std::endl;
58 } else {
59 m_tuple1->addItem ("part", m_shower_part);
60 m_tuple1->addItem ("layer", m_shower_layer);
61 m_tuple1->addItem ("im", m_shower_im);
62 m_tuple1->addItem ("zpos", m_shower_zpos);
63 m_tuple1->addItem ("energy", m_shower_energy);
64 }
65
66 m_tuple2 = tuple2;
67 if(!m_tuple2) {
68 std::cerr << "Invalid ntuple2 in TofEnergyRec!" << std::endl;
69 } else {
70 m_tuple2->addItem ("dist", m_seed_dist);
71 }
72}

Referenced by TofEnergyRec::initialize().

◆ calib()

double TofShower::calib ( const int n,
const int m ) const

Definition at line 1002 of file TofShower.cxx.

1003{
1004 if(n<176&&m<4) {
1005 return m_calib[n][m];
1006 } else {
1007 return 0;
1008 }
1009}
const Int_t n

◆ calibConst()

double TofShower::calibConst ( ) const
inline

Definition at line 55 of file TofShower.h.

55{ return m_calibConst; }

◆ ecalib()

double TofShower::ecalib ( const int nsci) const

Definition at line 986 of file TofShower.cxx.

987{
988 if(nsci<176) {
989 return m_ecalib[nsci];
990 } else {
991 return 0;
992 }
993}

Referenced by setCalib(), and setEcalib().

◆ energyCalib()

void TofShower::energyCalib ( vector< TofData * > & tofDataVec,
RecTofTrackCol * recTofTrackCol )

Definition at line 74 of file TofShower.cxx.

75{
76 //Get TOF Calibtration Service
77 ISvcLocator* svcLocator = Gaudi::svcLocator();
79 StatusCode sc = svcLocator->service("TofCaliSvc", tofCaliSvc);
80 if (sc != StatusCode::SUCCESS) {
81 cout << "TofEnergyRec Get Calibration Service Failed !! " << endl;
82 }
83
85 sc = svcLocator->service("TofQCorrSvc", tofQCorrSvc);
86 if (sc != StatusCode::SUCCESS) {
87 cout << "TofEnergyRec Get QCorr Service Failed !! " << endl;
88 }
89
91 sc = svcLocator->service("TofQElecSvc", tofQElecSvc);
92 if (sc != StatusCode::SUCCESS) {
93 cout << "TofEnergyRec Get QElec Service Failed !! " << endl;
94 }
95
96 vector<TofData*>::iterator it;
97 for(it=tofDataVec.begin();
98 it!=tofDataVec.end();
99 it++) {
100
101 Identifier id((*it)->identify());
102 int barrel_ec = TofID::barrel_ec(id);
103 int layer = TofID::layer(id);
104 int im = TofID::phi_module(id);
105 int end = TofID::end(id);
106 bool is_mrpc = TofID::is_mymrpc(id);
107
108
109 if(m_output) {
110 m_part = barrel_ec;
111 m_layer = layer;
112 m_im = im;
113 m_end = end;
114 }
115
116 if((*it)->barrel()) {
117 TofData* bTofData = (*it);
118 bTofData->setZpos(99.);
119 bTofData->setEnergy(0.);
120 if(bTofData->tdc1()<=0||bTofData->tdc1()>8000||bTofData->tdc2()<=0||bTofData->tdc2()>8000) continue;
121
122 double adc1,adc2,tdc1,tdc2;
123 tdc1 = bTofData->tdc1();
124 tdc2 = bTofData->tdc2();
125 adc1 = bTofData->adc1();
126 adc2 = bTofData->adc2();
127
128 //from data CalibSvc
129 double zpos = tofCaliSvc->ZTDC( tdc1, tdc2, bTofData->tofId() );
130 if(fabs(zpos)>115) continue;
131 double tofq = tofCaliSvc->BPh( adc1, adc2, zpos, bTofData->tofId());
132 if(tofq<100||tofq>10000) continue;
133 //double energy = q*0.0036;
134 double energy = tofq*m_calibConst; //new calibration result in 2009.9.27
135 //cout<< "TofShower Barrel energy " << energy << endl;
136 zpos /= 100.; //cm->m
137
138 bTofData->setZpos(zpos);
139 bTofData->setEnergy(energy);
140
141 if(m_output) {
142 m_part = barrel_ec;
143 m_layer = layer;
144 m_im = im;
145 m_end = end;
146 m_adc1 = bTofData->adc1();
147 m_adc2 = bTofData->adc2();
148 m_tdc1 = bTofData->tdc1();
149 m_tdc2 = bTofData->tdc2();
150 m_zpos = zpos;
151 m_energy = energy;
152 m_tuple->write();
153 }
154
155 } else {
156
157 if(!is_mrpc)
158 {
159 //cout<<"endcap"<<endl;
160 //ETofData* eTofData = dynamic_cast<ETofData*>(*it);
161 //TofData* bTofData = (*it);
162 //double energy = 2*eTofData->adcChannel()/140;
163 //eTofData->setEnergy(energy);
164 }
165 else if(is_mrpc)
166 {
167
168 TofData* eTofData = (*it);
169 double charge_ns = eTofData->adc(); // time over threshold in ns
170
171 //The next step is to determine the energy deposit in the module. We have three different cases: Neutral tracks, Charged tracks with neighbour, charged track without neighbour
172 bool neutral =true;
173 bool neighborhood = false; //Are more than two cells fired?
174
175 int partId_all = barrel_ec;
176 int module_all = im/25;
177 int strip_all = im%25;
178
179 int partId_charged =-9999;
180 int module_charged =-9999;
181 int strip_charged =-9999;
182
183
184
185
186
187 RecTofTrackCol::iterator rec_charged;
188
189
190 for( rec_charged = recTofTrackCol->begin(); rec_charged != recTofTrackCol->end();rec_charged++)
191 {
192
193
194
195
196
197 TofHitStatus *status = new TofHitStatus;
198 status->setStatus((*rec_charged)->status());
199 if((status->is_barrel())) continue; //Consider only endcap tracks
200 if((*rec_charged)->tofID()<=125) continue;
201
202 if(status->is_east())
203 {
204 if((*rec_charged)->tofID()>=600) {partId_charged=3; module_charged = ((*rec_charged)->tofID()-574)/25; strip_charged =((*rec_charged)->tofID()-574)%25; }
205 else {partId_charged=4; module_charged = ((*rec_charged)->tofID()-100)/25; strip_charged =((*rec_charged)->tofID()-100)%25; }
206 }
207 else
208 {
209 if((*rec_charged)->tofID()>=600) {partId_charged=6; module_charged = ((*rec_charged)->tofID()-574)/25; strip_charged =((*rec_charged)->tofID()-574)%25; }
210 else {partId_charged=5;module_charged = ((*rec_charged)->tofID()-100)/25; strip_charged =((*rec_charged)->tofID()-100)%25;}
211 }
212
213 delete status;
214
215
216 //Determine wether a track is neutral or not:
217 if( (partId_all==3 || partId_all==4) && (partId_charged==3 || partId_charged==4 ) )
218 {
219 if( partId_all==partId_charged && module_charged == module_all && abs(strip_charged-strip_all)<3) neutral =false;
220 if( partId_all==partId_charged && module_charged == module_all)
221 {
222 if(strip_all%2==0 && strip_charged%2!=0 && strip_charged<strip_all && abs(strip_charged-strip_all)<4) neutral =false;
223 if(strip_all%2!=0 && strip_charged%2==0 && strip_charged>strip_all && abs(strip_charged-strip_all)<4) neutral =false;
224 }
225
226
227 if( partId_all!=partId_charged && abs(module_charged-module_all)<2)
228 {
229 if(strip_all%2==0 && strip_charged%2!=0 && abs(strip_charged-strip_all)<3 ) neutral =false;
230 if(strip_all%2==0 && strip_charged%2!=0 && strip_charged<strip_all && abs(strip_charged-strip_all)<4) neutral =false;
231
232 if(strip_all%2!=0 && strip_charged%2==0 && abs(strip_charged-strip_all)<3 ) neutral =false;
233 if(strip_all%2!=0 && strip_charged%2==0 && strip_charged>strip_all && abs(strip_charged-strip_all)<4) neutral =false;
234 }
235
236 }
237 else if ( (partId_all==5 || partId_all==6) && (partId_charged==5 || partId_charged==6 ) )
238 {
239 if( partId_all==partId_charged && module_charged ==module_all && abs(strip_charged-strip_all)<3) neutral =false;
240
241 if( partId_all==partId_charged && module_charged == module_all)
242 {
243 if(strip_all%2==0 && strip_charged%2!=0 && strip_charged<strip_all && abs(strip_charged-strip_all)<4) neutral =false;
244 if(strip_all%2!=0 && strip_charged%2==0 && strip_charged>strip_all && abs(strip_charged-strip_all)<4) neutral =false;
245 }
246
247
248 if( partId_all!=partId_charged && abs(module_charged-module_all)<2)
249 {
250 if(strip_all%2==0 && strip_charged%2!=0 && abs(strip_charged-strip_all)<3 ) neutral =false;
251 if(strip_all%2==0 && strip_charged%2!=0 && strip_charged<strip_all && abs(strip_charged-strip_all)<4) neutral =false;
252
253 if(strip_all%2!=0 && strip_charged%2==0 && abs(strip_charged-strip_all)<3 ) neutral =false;
254 if(strip_all%2!=0 && strip_charged%2==0 && strip_charged>strip_all && abs(strip_charged-strip_all)<4) neutral =false;
255 }
256 }
257
258 }//Close for rec charegd Track
259
260 //Yet we do know wether the track is neutral or not
261
262 //Next step: Determine wether the track has neighborhood (Have two strips in a neighborhood fired?)
263 vector<TofData*>::iterator it_temp;
264 for(it_temp=tofDataVec.begin();it_temp!=tofDataVec.end();it_temp++)
265 {
266
267 Identifier id_temp((*it_temp)->identify());
268 int partId_temp = TofID::barrel_ec(id_temp);
269 int im_temp = TofID::phi_module(id_temp);
270 int module_temp = im_temp/25;
271 int strip_temp = im_temp%25;
272 bool is_mrpc_temp = TofID::is_mymrpc(id_temp);
273
274 if( partId_temp==1 ) continue;
275 if(!is_mrpc_temp) continue;
276
277 if( (partId_all==3 || partId_all==4) && (partId_temp==3 || partId_temp==4 ) )
278 {
279 if( partId_all==partId_temp && module_temp == module_all && abs(strip_temp-strip_all)!=0 && abs(strip_temp-strip_all)<3) neighborhood =true;
280 if( partId_all==partId_temp && module_temp == module_all)
281 {
282 if(strip_all%2==0 && strip_temp%2!=0 && strip_temp<strip_all && abs(strip_temp-strip_all)<4 && abs(strip_temp-strip_all)!=0) neighborhood =true;
283 if(strip_all%2!=0 && strip_temp%2==0 && strip_temp>strip_all && abs(strip_temp-strip_all)<4 && abs(strip_temp-strip_all)!=0) neighborhood =true;
284 }
285
286 if( partId_all!=partId_temp && abs(module_temp-module_all)<2)
287 {
288 if(strip_all%2==0 && strip_temp%2!=0 && abs(strip_temp-strip_all)<3 ) neighborhood =true;
289 if(strip_all%2==0 && strip_temp%2!=0 && strip_temp<strip_all && abs(strip_temp-strip_all)<4) neighborhood =true;
290
291 if(strip_all%2!=0 && strip_temp%2==0 && abs(strip_temp-strip_all)<3 ) neighborhood =true;
292 if(strip_all%2!=0 && strip_temp%2==0 && strip_temp>strip_all && abs(strip_temp-strip_all)<4) neighborhood =true;
293 }
294
295 }//close if partid 3 & 4
296 else if( (partId_all==5 || partId_all==6) && (partId_temp==5 || partId_temp==6 ) )
297 {
298 if( partId_all==partId_temp && module_temp == module_all && abs(strip_temp-strip_all)!=0 && abs(strip_temp-strip_all)<3) neighborhood =true;
299 if( partId_all==partId_temp && module_temp == module_all)
300 {
301 if(strip_all%2==0 && strip_temp%2!=0 && strip_temp<strip_all && abs(strip_temp-strip_all)<4 && abs(strip_temp-strip_all)!=0) neighborhood =true;
302 if(strip_all%2!=0 && strip_temp%2==0 && strip_temp>strip_all && abs(strip_temp-strip_all)<4 && abs(strip_temp-strip_all)!=0) neighborhood =true;
303 }
304
305 if( partId_all!=partId_temp && abs(module_temp-module_all)<2)
306 {
307 if(strip_all%2==0 && strip_temp%2!=0 && abs(strip_temp-strip_all)<3 ) neighborhood =true;
308 if(strip_all%2==0 && strip_temp%2!=0 && strip_temp<strip_all && abs(strip_temp-strip_all)<4) neighborhood =true;
309
310 if(strip_all%2!=0 && strip_temp%2==0 && abs(strip_temp-strip_all)<3 ) neighborhood =true;
311 if(strip_all%2!=0 && strip_temp%2==0 && strip_temp>strip_all && abs(strip_temp-strip_all)<4) neighborhood =true;
312 }
313
314 }//close if partid 5 & 6
315
316 }
317
318
319 double energy =0; // in MeV
320
321 energy = mrpcCaliSvc->GetEnergyCalibration(charge_ns,neutral,neighborhood);
322 eTofData->setEnergy(energy);//set the energy loss in MeV
323
324
325
326 }//close if(is_mrpc)
327
328 }//close else (endcap)
329 }
330}
double abs(const EvtComplex &c)
************Class m_ypar INTEGER m_KeyWgt INTEGER m_nphot INTEGER m_KeyGPS INTEGER m_IsBeamPolarized INTEGER m_EvtGenInterface DOUBLE PRECISION m_Emin DOUBLE PRECISION m_sphot DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_q2 DOUBLE PRECISION m_PolBeam2 DOUBLE PRECISION m_xErrPb *COMMON c_KK2f $ !CMS energy average $ !Spin Polarization vector first beam $ !Spin Polarization vector second beam $ !Beam energy spread[GeV] $ !minimum hadronization energy[GeV] $ !input READ never touch them !$ !debug facility $ !maximum weight $ !inverse alfaQED $ !minimum real photon energy
Definition KK2f.h:50
ITofQElecSvc * tofQElecSvc
ITofQCorrSvc * tofQCorrSvc
ITofCaliSvc * tofCaliSvc
virtual const double BPh(double ADC1, double ADC2, double zHit, unsigned int id)=0
virtual const double ZTDC(double tleft, double tright, unsigned id)=0
double GetEnergyCalibration(double, bool, bool)
int tofId()
Definition TofData.cxx:494
void setEnergy(double energy)
Definition TofData.h:212
double adc2()
Definition TofData.cxx:580
void setZpos(double zpos)
Definition TofData.h:211
double adc()
Definition TofData.cxx:598
double tdc2()
Definition TofData.cxx:589
double tdc1()
Definition TofData.cxx:571
double adc1()
Definition TofData.cxx:562
bool is_barrel() const
void setStatus(unsigned int status)
bool is_east() const
static int end(const Identifier &id)
Definition TofID.cxx:129
static int phi_module(const Identifier &id)
Definition TofID.cxx:117
static int barrel_ec(const Identifier &id)
Values of different levels (failure returns 0)
Definition TofID.cxx:95
static bool is_mymrpc(const Identifier &id)
Definition TofID.cxx:58
static int layer(const Identifier &id)
Definition TofID.cxx:109

Referenced by findShower().

◆ findSeed()

void TofShower::findSeed ( vector< TofData * > & tofDataVec)

Definition at line 547 of file TofShower.cxx.

548{
549 bool max=false;
550 m_seedVec.clear();
551
552 vector<TofData*>::iterator it;
553 for(it=tofDataVec.begin();
554 it!=tofDataVec.end();
555 it++) {
556 if((*it)->barrel()) { //barrel
557 TofData* bTofData = (*it);
558
559
560
561 //cout << "Identifier(bTofData->identify()) " << Identifier(bTofData->identify()) << endl;
562 //std::cout << "TofShower bTofData->energy() = " << bTofData->energy() << std::endl;
563 if(bTofData->energy()<5.) continue; //seed energy cut = 6MeV
564
565 max=true;
566 vector<Identifier> NeighborVec=getNextNeighbors(Identifier(bTofData->identify()));
567
568 //const Identifier & help = Identifier(bTofData->identify());
569 //cout << "TofShower::findSeed Barrel Track base "<<TofID::layer(help) << " " << TofID::phi_module(help) << endl;
570
571 vector<Identifier>::iterator iNeigh;
572 for(iNeigh=NeighborVec.begin();
573 iNeigh!=NeighborVec.end();
574 iNeigh++) {
575
576 //const Identifier & help2 = Identifier(*iNeigh);
577 //cout << "TofShower::findSeed Barrel Track neigh "<<TofID::layer(help2) << " " << TofID::phi_module(help2) << endl;
578
579 vector<TofData*>::iterator it2;
580 for(it2=tofDataVec.begin();
581 it2!=tofDataVec.end();
582 it2++) {
583 if((*it2)->identify()==*iNeigh) {
584 TofData* bTofData2 = (*it2);
585 if(bTofData2->energy()>bTofData->energy()) {
586 max=false;
587 }
588 break;
589 }
590 }
591
592 }
593 }
594 else { //endcap
595
596 //cout << "TofShower::findSeed Endcap Track" << endl;
597 TofData* eTofData = (*it);
598
599 Identifier id((*it)->identify());
600 bool is_mrpc = TofID::is_mymrpc(id);
601
602
603 if(!is_mrpc)
604 {
605 if(eTofData->energy()<5.) continue; //seed energy cut = 5MeV
606 max=true;
607 vector<Identifier> NeighborVec=getNextNeighbors(Identifier(eTofData->identify()));
608 vector<Identifier>::iterator iNeigh;
609 for(iNeigh=NeighborVec.begin(); iNeigh!=NeighborVec.end(); iNeigh++)
610 {
611
612 vector<TofData*>::iterator it2;
613 for(it2=tofDataVec.begin(); it2!=tofDataVec.end(); it2++)
614 {
615 if((*it2)->identify()==*iNeigh) {
616 TofData* eTofData2 = (*it2);
617 if(eTofData2->energy()>eTofData->energy()) {
618 max=false;
619 }
620 break;
621 }
622 }//close for
623 }//Close for
624 }//close if(!is_mrpc)
625 else if(is_mrpc)
626 {
627
628 //cout << "TofShower::findSeed MRPC Track "<< Identifier(eTofData->identify()) << endl;
629 if(eTofData->energy()<2.) continue; //Seed energy cut = 2 MeV
630 max=true;
631
632 vector<Identifier> NeighborVec=getMRPC_neighbours(Identifier(eTofData->identify()));
633
634 //cout << "TofShower::findSeed getMRPC_neighbours OK" << endl;
635 vector<Identifier>::iterator iNeigh;
636
637 for(iNeigh=NeighborVec.begin(); iNeigh!=NeighborVec.end(); iNeigh++)
638 {
639 //cout << "TofShower::findSeed Phimodule MRPC " << TofID::phi_module(*iNeigh) <<endl;
640 vector<TofData*>::iterator it2;
641 for(it2=tofDataVec.begin(); it2!=tofDataVec.end(); it2++)
642 {
643 if((*it2)->identify()==*iNeigh) {
644 TofData* eTofData2 = (*it2);
645 if(eTofData2->energy()>eTofData->energy()) {
646 max=false;
647 }
648 break;
649 }
650 }//close for
651 }//Close for
652 //cout << "TofShower::findSeed Both forloops done" << endl;
653
654 }//Close else if(is_mrpc)
655
656 } //close else endcap
657
658
659 if(max) {
660 m_seedVec.push_back(Identifier((*it)->identify()));
661 }
662
663 }//close loop over tofdata
664}//close find seed
double energy() const
Definition TofData.h:197
unsigned int identify() const
Definition TofData.h:131
vector< Identifier > getMRPC_neighbours(const Identifier &id)
vector< Identifier > getNextNeighbors(const Identifier &id)

Referenced by findShower().

◆ findShower()

void TofShower::findShower ( vector< TofData * > & tofDataVec,
RecTofTrackCol * recTofTrackCol,
double t0 )

Definition at line 666 of file TofShower.cxx.

667{
668
669 energyCalib(tofDataVec, recTofTrackCol);
670 //cout << "TofShower::findShower energycalib OK" << endl;
671 findSeed(tofDataVec);
672 //cout << "TofShower::findShower findseed OK" << endl;
673
674 vector<Identifier>::iterator iSeed;
675
676 for(iSeed=m_seedVec.begin(); iSeed!=m_seedVec.end(); iSeed++)
677 {
678
679 bool is_mrpc = TofID::is_mymrpc(*iSeed);
680
681
682 if(!is_mrpc) //Old TofDetector + barrel
683 {
684 int barrel_ec = TofID::barrel_ec(*iSeed);
685 int layer = TofID::layer(*iSeed);
686 int im = TofID::phi_module(*iSeed);
687 im += layer * 88;
688
689 bool neutral=true;
690 //match with Tof charged track
691 int dphi=999;
692 RecTofTrackCol::iterator iTrack, iMatch;
693 for(iTrack=recTofTrackCol->begin(); iTrack!=recTofTrackCol->end(); iTrack++)
694 {
695 if(barrel_ec==1) {
696 dphi=abs(im-(*iTrack)->tofID());
697 dphi = dphi>=44 ? 88-dphi : dphi;
698 } else if(barrel_ec==2) {
699 dphi=abs(im-(*iTrack)->tofID()+48);
700 dphi = dphi>=24 ? 48-dphi : dphi;
701 } else {
702 dphi=abs(im-(*iTrack)->tofID());
703 dphi = dphi>=24 ? 48-dphi : dphi;
704 }
705 if(abs(dphi)<=2) {
706 iMatch = iTrack;
707 neutral=false;
708 break;
709 }
710 }
711
712 //energy sum of seed and its neighbors
713 //use avarage mean to calculation position
714 double zpos=0;
715 double energy=0;
716 double seedPos=0;
717
718
719 //cout << "Energhy =0 " << endl;
720 vector<TofData*>::iterator it;
721 for(it=tofDataVec.begin(); it!=tofDataVec.end(); it++)
722 {
723 if((*it)->identify()==*iSeed) {
724 //cout<<"iSeed="<<*iSeed<<endl;
725 if((*it)->barrel()) {
726 TofData* bTofData = (*it);
727 zpos+=bTofData->zpos()*bTofData->energy();
728 energy+=bTofData->energy();
729 seedPos=bTofData->zpos();
730
731 //cout << "Add energy barrel seed "<< TofID::layer(*iSeed) <<" " << TofID::phi_module(*iSeed) << " " << bTofData->energy() << " ---> "<< energy <<endl;
732 } else {
733 TofData* eTofData = (*it);
734 energy+=eTofData->energy();
735
736 //cout << "Add energy" << endl;
737 }
738 break;
739 }
740 }
741
742 vector<Identifier> NeighborVec=getNextNeighbors(*iSeed);
743 vector<Identifier>::iterator iNeigh;
744 for(iNeigh=NeighborVec.begin(); iNeigh!=NeighborVec.end(); iNeigh++)
745 {
746
747 vector<TofData*>::iterator it2;
748 for(it2=tofDataVec.begin(); it2!=tofDataVec.end(); it2++)
749 {
750 if((*it2)->identify()==*iNeigh) {
751 //cout<<"iNeigh="<<*iNeigh<<endl;
752 if((*it)->barrel()) {
753 TofData* bTofData2 = (*it2);
754
755 if(fabs(bTofData2->zpos())>2) continue;
756 if(m_output) {
757 m_seed_dist = seedPos-bTofData2->zpos();
758 m_tuple2->write();
759 }
760 if(fabs(seedPos-bTofData2->zpos())>0.3) continue;
761 zpos+=bTofData2->zpos()*bTofData2->energy();
762 energy+=bTofData2->energy();
763 //cout << "Add energy barrel neig " << TofID::layer(*iNeigh) <<" " << TofID::phi_module(*iNeigh) << " " << bTofData2->energy() << " ---> "<< energy <<endl;
764 } else {
765 TofData* eTofData2 = (*it2);
766 energy+=eTofData2->energy();
767 }
768 break;
769 }
770 }
771 }
772 if(energy>0) zpos/=energy;
773
774 //for charged track, set energy
775 if(neutral==false) {
776 if(fabs(zpos)<1.15&&energy>5.&&energy<1000) {
777 (*iMatch)->setEnergy(energy/1000);
778 }
779 continue;
780 }
781
782 //for neutral track
783 if(fabs(zpos)<1.15&&energy>5.&&energy<1000) { //shower energy cut = 10MeV
784 RecTofTrack* tof = new RecTofTrack;
785 tof->setTofID(*iSeed);
786 tof->setZrHit(zpos);
787 tof->setEnergy(energy/1000); //MeV-->GeV
788 recTofTrackCol->push_back(tof);
789
790 if(m_output) {
791 m_shower_part = barrel_ec;
792 m_shower_layer = layer;
793 m_shower_im = im;
794 m_shower_zpos = zpos;
795 m_shower_energy = energy;
796 m_tuple1->write();
797 }
798 }
799 }//close if(!is_mrpc)
800 else // mrpc_case
801 {
802 //Determine wether the track is a neutral one or not:(Compare with charged tracks)
803
804 //cout << "TofShower::findShower Seed is mrpc" << endl;
805
806 bool neutral =true;
807 int partId_seed = TofID::barrel_ec(*iSeed);
808 int module_seed = TofID::phi_module(*iSeed)/25;
809 int strip_seed = TofID::phi_module(*iSeed)%25;
810
811
812
813 RecTofTrackCol::iterator rec_charged,iMatch;
814 for( rec_charged = recTofTrackCol->begin(); rec_charged != recTofTrackCol->end();rec_charged++)
815 {
816
817 TofHitStatus *status = new TofHitStatus;
818 status->setStatus((*rec_charged)->status());
819 if((status->is_barrel())) continue; //Consider only endcap tracks
820 if((*rec_charged)->tofID()<=125) continue;
821
822 int partId_charged =-1;
823 int module_charged =-1;
824 int strip_charged =-1;
825
826 if(status->is_east())
827 {
828 if((*rec_charged)->tofID()>=600) {partId_charged=3; module_charged = ((*rec_charged)->tofID()-574)/25; strip_charged =((*rec_charged)->tofID()-574)%25; }
829 else {partId_charged=4; module_charged = ((*rec_charged)->tofID()-100)/25; strip_charged =((*rec_charged)->tofID()-100)%25; }
830 }
831 else
832 {
833 if((*rec_charged)->tofID()>=600) {partId_charged=6; module_charged = ((*rec_charged)->tofID()-574)/25; strip_charged =((*rec_charged)->tofID()-574)%25; }
834 else {partId_charged=5;module_charged = ((*rec_charged)->tofID()-100)/25; strip_charged =((*rec_charged)->tofID()-100)%25;}
835 }
836
837 delete status;
838
839 if( (partId_seed==3 || partId_seed==4) && (partId_charged==3 || partId_charged==4 ) )
840 {
841 if( partId_seed==partId_charged && module_charged == module_seed && abs(strip_charged-strip_seed)<3) {iMatch=rec_charged; neutral =false; break;}
842 if( partId_seed==partId_charged && module_charged == module_seed)
843 {
844 if(strip_seed%2==0 && strip_charged%2!=0 && strip_charged<strip_seed && abs(strip_charged-strip_seed)<4) {iMatch=rec_charged; neutral =false; break;}
845 if(strip_seed%2!=0 && strip_charged%2==0 && strip_charged>strip_seed && abs(strip_charged-strip_seed)<4) {iMatch=rec_charged; neutral =false; break;}
846 }
847
848
849 if( partId_seed!=partId_charged && abs(module_charged-module_seed)<2)
850 {
851 if(strip_seed%2==0 && strip_charged%2!=0 && abs(strip_charged-strip_seed)<3 ) {iMatch=rec_charged; neutral =false; break;}
852 if(strip_seed%2==0 && strip_charged%2!=0 && strip_charged<strip_seed && abs(strip_charged-strip_seed)<4) {iMatch=rec_charged; neutral =false; break;}
853
854 if(strip_seed%2!=0 && strip_charged%2==0 && abs(strip_charged-strip_seed)<3 ) {iMatch=rec_charged; neutral =false; break;}
855 if(strip_seed%2!=0 && strip_charged%2==0 && strip_charged>strip_seed && abs(strip_charged-strip_seed)<4) {iMatch=rec_charged; neutral =false; break;}
856 }
857
858 }
859 else if ( (partId_seed==5 || partId_seed==6) && (partId_charged==5 || partId_charged==6 ) )
860 {
861 if( partId_seed==partId_charged && module_charged ==module_seed && abs(strip_charged-strip_seed)<3) {iMatch=rec_charged; neutral =false; break;}
862
863 if( partId_seed==partId_charged && module_charged == module_seed)
864 {
865 if(strip_seed%2==0 && strip_charged%2!=0 && strip_charged<strip_seed && abs(strip_charged-strip_seed)<4) {iMatch=rec_charged; neutral =false; break;}
866 if(strip_seed%2!=0 && strip_charged%2==0 && strip_charged>strip_seed && abs(strip_charged-strip_seed)<4) {iMatch=rec_charged; neutral =false; break;}
867 }
868
869 if( partId_seed!=partId_charged && abs(module_charged-module_seed)<2)
870 {
871 if(strip_seed%2==0 && strip_charged%2!=0 && abs(strip_charged-strip_seed)<3 ) {iMatch=rec_charged; neutral =false; break;}
872 if(strip_seed%2==0 && strip_charged%2!=0 && strip_charged<strip_seed && abs(strip_charged-strip_seed)<4) {iMatch=rec_charged; neutral =false; break;}
873
874 if(strip_seed%2!=0 && strip_charged%2==0 && abs(strip_charged-strip_seed)<3 ) {iMatch=rec_charged; neutral =false; break;}
875 if(strip_seed%2!=0 && strip_charged%2==0 && strip_charged>strip_seed && abs(strip_charged-strip_seed)<4) {iMatch=rec_charged; neutral =false; break;}
876 }
877 }
878
879 }//Close for rec charegd Track
880
881 //cout << "TofShower::findShower Charged/Neutral ? -> OK" << endl;
882
883
884
885 //Now sum up the energy of the seed and its neighbours:
886
887 double energy=0;
888 double timeinfo_neutral=0;
889 double charge_neutral=0;
890 vector<TofData*>::iterator it;
891 for(it=tofDataVec.begin();it!=tofDataVec.end();it++)
892 {
893 if((*it)->barrel()) continue; //We sum up only endcap data
894
895 if((*it)->identify()==*iSeed)
896 {
897 TofData *eTofData = (*it);
898 energy+=eTofData->energy();
899 timeinfo_neutral= eTofData->tdc();
900 charge_neutral= eTofData->adc();// time over threshold in ns.
901
902 //cout<< "TofShower::findShower : Summing up energy " << endl;
903 //cout << " Seed " << (int)(TofID::phi_module(*iSeed)/25)<< " | " << (int)(TofID::phi_module(*iSeed)%25) << " | " << energy <<endl;
904
905 break;
906 }
907 }
908 //Now add the energy from the neighbours
909
910
911 vector<Identifier> NeighborVec=getMRPC_neighbours(*iSeed);
912 vector<Identifier>::iterator iNeigh;
913 for(iNeigh=NeighborVec.begin(); iNeigh!=NeighborVec.end(); iNeigh++)
914 {
915
916 vector<TofData*>::iterator it2;
917 for(it2=tofDataVec.begin();it2!=tofDataVec.end();it2++)
918 {
919 if((*it2)->identify()==(*iNeigh))
920 {
921 TofData * eTofData2 = (*it2);
922 energy+=eTofData2->energy();
923 //cout << " Neigh " << (int)(TofID::phi_module(*iNeigh)/25)<< " | " << (int)(TofID::phi_module(*iNeigh)%25) << " | " << energy <<endl;
924 break;
925 }
926 }//Close for it2
927
928 }//close for i neigh.,
929
930
931
932 if(neutral==false) // set energy for charged Tracks!
933 {
934 if(energy<1000) (*iMatch)->setEnergy(energy/1000.); //MeV->GeV
935
936 continue;
937 }
938
939
940 if(neutral == true)
941 {
942
943
944 double tof= timeinfo_neutral-t0;
945 if(tof<0) tof=0;
946
947
948 RecTofTrack* tof_track =new RecTofTrack;
949 tof_track->setTofID(*iSeed);
950 tof_track->setTof(tof);//time of flight in ns
951 tof_track->setPh(charge_neutral);//collected ADC charge
952 tof_track->setEnergy(energy/1000.); //MeV->GeV ; Energyloss for the seed and its neighborhood for the whole tof module!!!!
953 recTofTrackCol->push_back(tof_track);
954
955 }
956
957
958 }//close else mrpc_case
959
960 }//close for over seeed
961}//close find shower!
void setEnergy(double energy)
void setPh(double ph)
Definition DstTofTrack.h:96
void setZrHit(double zrhit)
Definition DstTofTrack.h:95
void setTof(double tof)
Definition DstTofTrack.h:97
void setTofID(int tofID)
Definition DstTofTrack.h:91
double zpos() const
Definition TofData.h:196
double tdc()
Definition TofData.cxx:607
void findSeed(vector< TofData * > &tofDataVec)
void energyCalib(vector< TofData * > &tofDataVec, RecTofTrackCol *recTofTrackCol)
Definition TofShower.cxx:74

Referenced by TofEnergyRec::execute().

◆ get_mrpc_partid_neighbour()

int TofShower::get_mrpc_partid_neighbour ( string which,
int stripid,
int layer )

Definition at line 1029 of file TofShower.cxx.

1030{
1031
1033
1034 int returnvalue=0;
1035
1036 if(which=="l")
1037 {
1038 if(strip%2==0) returnvalue = layer;
1039 else
1040 {
1041 if(layer==3) returnvalue = 4;
1042 if(layer==4) returnvalue = 3;
1043 if(layer==5) returnvalue = 6;
1044 if(layer==6) returnvalue = 5;
1045 }
1046 }
1047
1048 if(which=="r")
1049 {
1050 if(strip%2!=0) returnvalue = layer;
1051 else
1052 {
1053 if(layer==3) returnvalue = 4;
1054 if(layer==4) returnvalue = 3;
1055 if(layer==5) returnvalue = 6;
1056 if(layer==6) returnvalue = 5;
1057 }
1058 }
1059
1060 if(which=="u")returnvalue = layer;
1061 if(which=="b")returnvalue = layer;
1062
1063 return returnvalue;
1064
1065}
static G4int Get_stripnumber_from_unique_identifier(G4int unique_identifier_f)

Referenced by getMRPC_neighbours().

◆ get_mrpc_stripid_neighbour()

int TofShower::get_mrpc_stripid_neighbour ( string which,
int stripid,
int layer )

Definition at line 1070 of file TofShower.cxx.

1071{
1074
1075 int neighbourstrip=0;
1076 int neighbourmodule=0;
1077
1078 int returnvalue=0;
1079
1080 if(strip==0) return 0; //Falls vorher schon strip 1,2 oder 23,24 gibt die Funtion 0 zurück, diese vlt. nochmalige Eingabe wird hier abgefangen und wieder eine 0 zureuckgegebn!
1081
1082 if(which=="l")
1083 {
1084 if(strip%2==0) //gerade Stripnummer
1085 {
1086 neighbourstrip=strip-1; //linke Nachbar ist dann immer -1
1087 if(layer==3 || layer== 6)
1088 {neighbourmodule=module;}//Nachbarmodul ist selbes Modul
1089 else
1090 {neighbourmodule=module;}//Nachbarmodul ist selbes Modul
1091 }
1092 else //ungerade stripnummer
1093 {
1094 neighbourstrip=strip+1;
1095
1096 if(layer==3 || layer== 5)
1097 {
1098 neighbourmodule=module; //In diesem Fall sind die Nachbarschaftsmodule immer gleich
1099 }
1100 else
1101 {
1102 neighbourmodule=module+1;
1103 if(neighbourmodule==19){neighbourmodule=1;}
1104 }
1105
1106 }
1107
1108 returnvalue= BesTofDigitizerEcV4::Produce_unique_identifier(neighbourmodule, neighbourstrip);
1109 } //close if which==l
1110
1111 else if(which=="r")
1112 {
1113 if(strip%2==0) //gerade Stripnummer
1114 {
1115 neighbourstrip=strip-1; //rechte Nachbar ist dann immer -1
1116
1117 if(layer==4 || layer== 6)
1118 {neighbourmodule=module;}//In diesem Fall ist das rechte Nachbarmodul immer die gleiche modulnummer
1119 else
1120 {neighbourmodule=module-1;
1121 if(neighbourmodule==0){neighbourmodule=18;}
1122 }
1123 }
1124 else //ungerade stripnummer
1125 {
1126 neighbourstrip=strip+1;
1127 if(layer==3 || layer== 6)
1128 {neighbourmodule=module;}//Nachbarmodul ist selbes Modul
1129 else
1130 {neighbourmodule=module;} //Nachbarmodul ist selbes Modul
1131
1132 }
1133
1134 returnvalue=BesTofDigitizerEcV4::Produce_unique_identifier(neighbourmodule, neighbourstrip);//geaendert: neighbourmodule=module in dieser und unter Funktionen entfernt..
1135 } //close if which==r
1136
1137 else if(which=="u")
1138 {
1139 if(strip==23 || strip==24) {neighbourmodule=0; neighbourstrip=0;}
1140 else
1141 {
1142 neighbourstrip=strip+2;
1143 neighbourmodule=module;
1144 }
1145
1146 returnvalue= BesTofDigitizerEcV4::Produce_unique_identifier(neighbourmodule, neighbourstrip);
1147 } //close if which==u
1148
1149 else if(which=="b")
1150 {
1151 if(strip==1 || strip==2) {neighbourmodule=0; neighbourstrip=0;}
1152 else
1153 {
1154 neighbourstrip=strip-2;
1155 neighbourmodule=module;
1156 }
1157
1158 returnvalue=BesTofDigitizerEcV4::Produce_unique_identifier(neighbourmodule, neighbourstrip);
1159 } //close if which==b
1160
1161
1162 return returnvalue;
1163}
static G4int Produce_unique_identifier(G4int module_mrpc_f, G4int readoutstripnumber_f)
static G4int Get_module_mrpc_from_unique_identifier(G4int unique_identifier_f)

Referenced by getMRPC_neighbours().

◆ getMRPC_neighbours()

vector< Identifier > TofShower::getMRPC_neighbours ( const Identifier & id)

Definition at line 469 of file TofShower.cxx.

470{
471 //This function returns the following neigbours (x=base)
472 // - - -
473 // - - -
474 // - x -
475 // - - -
476 // - - -
477
478
479 vector<Identifier> NeighborVec;
480
481 int partid_it = TofID::barrel_ec(id);
482 int tofid_it = TofID::phi_module(id);
483
484
485 //int module= BesTofDigitizerEcV4::Get_module_mrpc_from_unique_identifier(partid_it);
486
487 int tofid_l = get_mrpc_stripid_neighbour("l",tofid_it,partid_it);
488 int partid_l = get_mrpc_partid_neighbour("l",tofid_it,partid_it);
489 int tofid_r = get_mrpc_stripid_neighbour("r",tofid_it,partid_it);
490 int partid_r = get_mrpc_partid_neighbour("r",tofid_it,partid_it);
491 int tofid_u = get_mrpc_stripid_neighbour("u",tofid_it,partid_it);
492 int partid_u =get_mrpc_partid_neighbour("u",tofid_it,partid_it);
493 int tofid_b = get_mrpc_stripid_neighbour("b",tofid_it,partid_it);
494 int partid_b = get_mrpc_partid_neighbour("b",tofid_it,partid_it);
495
496 int tofid_lu = get_mrpc_stripid_neighbour("u",tofid_l,partid_l);
497 int partid_lu = get_mrpc_partid_neighbour("u",tofid_l,partid_l);
498 int tofid_lb = get_mrpc_stripid_neighbour("b",tofid_l,partid_l);
499 int partid_lb = get_mrpc_partid_neighbour("b",tofid_l,partid_l);
500 int tofid_ru = get_mrpc_stripid_neighbour("u",tofid_r,partid_r);
501 int partid_ru = get_mrpc_partid_neighbour("u",tofid_r,partid_r);
502 int tofid_rb = get_mrpc_stripid_neighbour("b",tofid_r,partid_r);
503 int partid_rb = get_mrpc_partid_neighbour("b",tofid_r,partid_r);
504
505 int tofid_luu = get_mrpc_stripid_neighbour("u",tofid_lu,partid_lu);
506 int partid_luu =get_mrpc_partid_neighbour("u",tofid_lu,partid_lu);
507 int tofid_lbb = get_mrpc_stripid_neighbour("b",tofid_lb,partid_lb);
508 int partid_lbb = get_mrpc_partid_neighbour("b",tofid_lb,partid_lb);
509 int tofid_ruu = get_mrpc_stripid_neighbour("u",tofid_ru,partid_ru);
510 int partid_ruu = get_mrpc_partid_neighbour("u",tofid_ru,partid_ru);
511 int tofid_rbb = get_mrpc_stripid_neighbour("b",tofid_rb,partid_rb);
512 int partid_rbb = get_mrpc_partid_neighbour("b",tofid_rb,partid_rb);
513 int tofid_uu = get_mrpc_stripid_neighbour("u",tofid_u,partid_u);
514 int partid_uu = get_mrpc_partid_neighbour("u",tofid_u,partid_u);
515 int tofid_bb = get_mrpc_stripid_neighbour("b",tofid_b,partid_b);
516 int partid_bb = get_mrpc_partid_neighbour("b",tofid_b,partid_b);
517
518
519
520
521
522
523 //if(tofid_it%25!=0) NeighborVec.push_back(TofID::cell_id_mrpc(partid_it,tofid_it));
524 if(tofid_l%25!=0) NeighborVec.push_back(TofID::cell_id_mrpc(partid_l,tofid_l));
525 if(tofid_r%25!=0) NeighborVec.push_back(TofID::cell_id_mrpc(partid_r,tofid_r));
526 if(tofid_u%25!=0) NeighborVec.push_back(TofID::cell_id_mrpc(partid_u,tofid_u));
527 if(tofid_b%25!=0) NeighborVec.push_back(TofID::cell_id_mrpc(partid_b,tofid_b));
528
529 if(tofid_lu%25!=0) NeighborVec.push_back(TofID::cell_id_mrpc(partid_lu,tofid_lu));
530 if(tofid_lb%25!=0) NeighborVec.push_back(TofID::cell_id_mrpc(partid_lb,tofid_lb));
531 if(tofid_ru%25!=0) NeighborVec.push_back(TofID::cell_id_mrpc(partid_ru,tofid_ru));
532 if(tofid_rb%25!=0) NeighborVec.push_back(TofID::cell_id_mrpc(partid_rb,tofid_rb));
533
534 if(tofid_luu%25!=0) NeighborVec.push_back(TofID::cell_id_mrpc(partid_luu,tofid_luu));
535 if(tofid_lbb%25!=0) NeighborVec.push_back(TofID::cell_id_mrpc(partid_lbb,tofid_lbb));
536 if(tofid_ruu%25!=0) NeighborVec.push_back(TofID::cell_id_mrpc(partid_ruu,tofid_ruu));
537 if(tofid_rbb%25!=0) NeighborVec.push_back(TofID::cell_id_mrpc(partid_rbb,tofid_rbb));
538 if(tofid_uu%25!=0) NeighborVec.push_back(TofID::cell_id_mrpc(partid_uu,tofid_uu));
539 if(tofid_bb%25!=0) NeighborVec.push_back(TofID::cell_id_mrpc(partid_bb,tofid_bb));
540
541
542 return NeighborVec;
543
544}//close getMRPC Neighbours
static Identifier cell_id_mrpc(int partID, int scinNum)
Definition TofID.cxx:177
int get_mrpc_stripid_neighbour(string which, int stripid, int layer)
int get_mrpc_partid_neighbour(string which, int stripid, int layer)

Referenced by findSeed(), and findShower().

◆ getNeighbors()

vector< Identifier > TofShower::getNeighbors ( const Identifier & id)

Definition at line 332 of file TofShower.cxx.

333{
334 vector<int> NeighborVec;
335 vector<Identifier> NeighborIdVec;
336 NeighborVec.clear();
337 NeighborIdVec.clear();
338
339 int barrel_ec = TofID::barrel_ec(id);
340 int layer = TofID::layer(id);
341 int im = TofID::phi_module(id);
342 int end = TofID::end(id);
343
344 if(barrel_ec==1) { //barrel
345 int num = im+layer*88;
346 if(num<88) { //layer1
347 if(num==0) {
348 NeighborVec.push_back(1);
349 NeighborVec.push_back(87);
350 NeighborVec.push_back(88);
351 NeighborVec.push_back(89);
352 } else if(num==87) {
353 NeighborVec.push_back(0);
354 NeighborVec.push_back(86);
355 NeighborVec.push_back(88);
356 NeighborVec.push_back(175);
357 } else {
358 NeighborVec.push_back(num+1);
359 NeighborVec.push_back(num-1);
360 NeighborVec.push_back(num+88);
361 NeighborVec.push_back(num+88+1);
362 }
363 } else {
364 if(num==88) {
365 NeighborVec.push_back(89);
366 NeighborVec.push_back(175);
367 NeighborVec.push_back(0);
368 NeighborVec.push_back(87);
369 } else if(num==175) {
370 NeighborVec.push_back(88);
371 NeighborVec.push_back(174);
372 NeighborVec.push_back(86);
373 NeighborVec.push_back(87);
374 } else {
375 NeighborVec.push_back(num+1);
376 NeighborVec.push_back(num-1);
377 NeighborVec.push_back(num-88);
378 NeighborVec.push_back(num-88-1);
379 }
380 }
381
382 int size=NeighborVec.size();
383 for(int i=0;i<size;i++) {
384 layer = NeighborVec[i]/88;
385 im = NeighborVec[i]%88;
386 NeighborIdVec.push_back(TofID::cell_id(barrel_ec,layer,im,end));
387 }
388 }
389
390 else { //endcap
391 if(im==0) {
392 NeighborVec.push_back(1);
393 NeighborVec.push_back(47);
394 } else if(im==47) {
395 NeighborVec.push_back(0);
396 NeighborVec.push_back(46);
397 } else {
398 NeighborVec.push_back(im-1);
399 NeighborVec.push_back(im+1);
400 }
401
402 int size=NeighborVec.size();
403 for(int i=0;i<size;i++) {
404 im = NeighborVec[i];
405 NeighborIdVec.push_back(TofID::cell_id(barrel_ec,layer,im,end));
406 }
407 }
408
409 return NeighborIdVec;
410}
static Identifier cell_id(int barrel_ec, int layer, int phi_module, int end)
For a single crystal.
Definition TofID.cxx:156
int num[96]
Definition ranlxd.c:373

Referenced by getNextNeighbors().

◆ getNextNeighbors()

vector< Identifier > TofShower::getNextNeighbors ( const Identifier & id)

Definition at line 412 of file TofShower.cxx.

413{
414 vector<Identifier> NeighborVec,tmpNeighborVec,tmpNextNeighborVec;
415 vector<Identifier>::iterator ci_NV,ci_tmpNV,ci_tmpNNV;
416 NeighborVec=getNeighbors(id);
417 tmpNeighborVec=getNeighbors(id);
418 bool flag=false; //whether NeighborVec already includes this crystal
419 bool flagNeighbor=false; //whether this crystal belongs to NeighborVec
420
421 //------------------------------------------------------------------
422 for(ci_tmpNV=tmpNeighborVec.begin();
423 ci_tmpNV!=tmpNeighborVec.end();
424 ci_tmpNV++){
425 tmpNextNeighborVec=getNeighbors(*ci_tmpNV);
426 //================================================================
427 for(ci_tmpNNV=tmpNextNeighborVec.begin();
428 ci_tmpNNV!=tmpNextNeighborVec.end();
429 ci_tmpNNV++){
430
431 for(ci_NV=NeighborVec.begin();
432 ci_NV!=NeighborVec.end();
433 ci_NV++){
434 if(*ci_tmpNNV==*ci_NV){ //this crystal is already included
435 flag=true;
436 break;
437 }
438 }
439
440 if(!flag){ //find a new crystal
441 //for(ci_tmpNV1=tmpNeighborVec.begin();
442 // ci_tmpNV1!=tmpNeighborVec.end();
443 // ci_tmpNV1++){
444 // if(*ci_tmpNNV==*ci_tmpNV1){ //this crystal belongs to NeighborVec
445 // flagNeighbor=true;
446 // break;
447 // }
448 //}
449
450 if(*ci_tmpNNV==id)
451 flagNeighbor=true;
452
453 if(!flagNeighbor)
454 NeighborVec.push_back(*ci_tmpNNV);
455 else
456 flagNeighbor=false;
457 }
458 else
459 flag=false;
460 }
461 //================================================================
462 }
463 //------------------------------------------------------------------
464
465 return NeighborVec;
466}
vector< Identifier > getNeighbors(const Identifier &id)

Referenced by findSeed(), and findShower().

◆ isData()

bool TofShower::isData ( ) const
inline

Definition at line 58 of file TofShower.h.

58{ return m_isData; }

Referenced by setIsData().

◆ readCalibPar()

void TofShower::readCalibPar ( )

Definition at line 963 of file TofShower.cxx.

964{
965 string paraPath = getenv("TOFENERGYRECROOT");
966 paraPath += "/share/peak.dat";
967 ifstream in;
968 in.open(paraPath.c_str());
969 assert(in);
970 for(int i=0;i<176;i++) {
971 in>>m_ecalib[i];
972 }
973 in.close();
974
975 paraPath = getenv("TOFENERGYRECROOT");
976 paraPath += "/share/calib.dat";
977 ifstream in1;
978 in1.open(paraPath.c_str());
979 assert(in1);
980 for(int i=0;i<176;i++) {
981 in1>>m_calib[i][0]>>m_calib[i][1]>>m_calib[i][2]>>m_calib[i][3];
982 }
983 in1.close();
984}

◆ setCalib()

void TofShower::setCalib ( const int n,
const int m,
const double ecalib )

Definition at line 1011 of file TofShower.cxx.

1012{
1013 if(n<176&&m<4) {
1014 m_calib[n][m]=ecalib;
1015 }
1016}
double ecalib(const int nsci) const

◆ setCalibConst()

void TofShower::setCalibConst ( const double cal)
inline

Definition at line 56 of file TofShower.h.

56{ m_calibConst = cal; }
std::string cal

Referenced by TofEnergyRec::initialize().

◆ setEcalib()

void TofShower::setEcalib ( const int nsci,
const double ecalib )

Definition at line 995 of file TofShower.cxx.

996{
997 if(nsci<176) {
998 m_ecalib[nsci]=ecalib;
999 }
1000}

◆ setIsData()

void TofShower::setIsData ( const bool isData)
inline

Definition at line 59 of file TofShower.h.

59{ m_isData = isData; }
bool isData() const
Definition TofShower.h:58

Referenced by TofEnergyRec::initialize().


The documentation for this class was generated from the following files: