00001
00002 #include "TDirectory.h"
00003 #include "TProcessID.h"
00004
00005 #include "root/MTEvent.hh"
00006 #include "root/MTChannel.hh"
00007
00008 #include "event/Event.hh"
00009 #include "event/ChannelHit.hh"
00010 #include "event/Run.hh"
00011 #include "geometry/Chamber.hh"
00012 #include "geometry/Chip.hh"
00013 #include "geometry/Board.hh"
00014 #include "geometry/Dif.hh"
00015 #include "geometry/Detector.hh"
00016 #include "tools/MicroException.hh"
00017 #include "tools/Log.hh"
00018
00019
00020 #include <iostream>
00021 #include <sstream>
00022
00023 using namespace std;
00024
00025 ClassImp(MTEvent)
00026
00027 TClonesArray *MTEvent::fgChannels = 0;
00028
00029
00030
00031
00032
00033
00034 MTEvent::MTEvent() : fTrack(NULL), fEventId(0), fTemperature(0.), fPressure(0), fTimestamp(0), fDifSynchro(0), fTimeInfo(true), fSquareEvt (false ), fBorderEvt (false ), fChipEvt (false ), fCrcIsCorrect(true), fNchannel(0), fValid(VALID)
00035 {
00036
00037
00038
00039
00040 if (!fgChannels) {
00041 fgChannels = new TClonesArray("MTChannel", 1000);
00042 }
00043 fChannels = fgChannels;
00044 fNbHitPerAbsTime.clear();
00045 }
00046
00047
00048 MTEvent::~MTEvent()
00049 {
00050 Clear();
00051 }
00052
00053
00054
00055
00056 MTEvent& MTEvent::operator=( const MTEvent& rhs)
00057 {
00058
00059
00060
00061 fSquareEvt = rhs.fSquareEvt;
00062 fBorderEvt = rhs.fBorderEvt;
00063 fChipEvt = rhs.fChipEvt;
00064 fTimeInfo = rhs.fTimeInfo;
00065 fEventId = rhs.fEventId;
00066 fTemperature = rhs.fTemperature;
00067 fPressure = rhs.fPressure;
00068 fDifSynchro = rhs.fDifSynchro;
00069 fTimestamp = rhs.fTimestamp;
00070 fGlobalTriggerCounter = rhs.fGlobalTriggerCounter;
00071 fDifTriggerCounter = rhs.fDifTriggerCounter;
00072 fCrcIsCorrect = rhs.fCrcIsCorrect;
00073 fValid = rhs.fValid;
00074 fNchannel = rhs.fNchannel;
00075
00076 fNbHitPerAbsTime = rhs.fNbHitPerAbsTime;
00077 fChannels = rhs.fChannels;
00078 fMeshVoltage = rhs.fMeshVoltage;
00079 fDriftVoltage = rhs.fDriftVoltage;
00080 fTrack = rhs.fTrack;
00081
00082 fTemperatureAsu1 = rhs.fTemperatureAsu1;
00083 fTemperatureAsu2 = rhs.fTemperatureAsu2;
00084 fTemperatureDif = rhs.fTemperatureDif;
00085
00086
00087
00088 }
00089
00090
00091 void MTEvent::Build(UInt_t evtId, ULong64_t difSynchro, Double32_t temperature, Double32_t pressure , ULong64_t timestamp )
00092 {
00093 fEventId=evtId;
00094 fTemperature=temperature;
00095 fPressure=pressure;
00096 fTimestamp=timestamp;
00097 fDifSynchro = difSynchro;
00098 }
00099
00100
00101 MTEvent& MTEvent::operator=(const Event& aEvent)
00102
00103 {
00104 try
00105 {
00106 fCrcIsCorrect = aEvent.getCrcIsCorrect();
00107 fValid = aEvent.getValidFlag();
00108 this->Build(aEvent.getId(), aEvent.getDifSynchro(), aEvent.getTemperature(), aEvent.getPressure(), aEvent.getTimeStamp());
00109 fTrack=NULL;
00110 fTimeInfo=true;
00111 fSquareEvt=false;
00112 fBorderEvt=false;
00113 fChipEvt=false;
00114
00115 fTemperatureAsu1 = aEvent.getTemperatureAsu1();
00116 fTemperatureAsu2 = aEvent.getTemperatureAsu2();
00117 fTemperatureDif = aEvent.getTemperatureDif();
00118
00119 ChamberMap_t chamberList = aEvent.getRun().getDetector().getChambers();
00120 for (ChamberMap_t::iterator iter=chamberList.begin(); iter!=chamberList.end(); iter++)
00121 {
00122 Chamber& chamber = *(iter->second);
00123 BoardMap_t boardList = chamber.getBoards();
00124 for ( BoardMap_t::iterator boardIter=boardList.begin(); boardIter!=boardList.end(); boardIter++)
00125 {
00126 ui32 difId = 0;
00127 Board& board = *(boardIter->second);
00128 try
00129 {
00130 const Dif* dif = board.getDif();
00131 if ( dif != NULL )
00132 {
00133 difId = board.getDif()->getId();
00134 }
00135 const BoardSlowControl& boardSC = aEvent.getBoardSlowControl(chamber.getId(),difId,board.getId());
00136 this->SetDriftVoltage(chamber.getId(),difId,board.getId(),boardSC.getDrift().voltage);
00137 this->SetMeshVoltage(chamber.getId(),difId,board.getId(),boardSC.getMesh().voltage);
00138 }
00139 catch ( MicroException e)
00140 {
00141 FILE_LOG(logDEBUG1) << "---BoardSlowControl not found chamberid[" << chamber.getId() << "] difId[" << difId <<"] boardId[" << board.getId() <<"]" << endl;
00142 }
00143 }
00144
00145
00146 this->SetGlobalTriggerCounter(aEvent.getGlobalTriggerCounter());
00147 this->SetDifTriggerCounter(aEvent.getDifTriggerCounter());
00148 try
00149 {
00150 const multiset<ChannelHit*,sorter>& list = aEvent.getChannelHitVector(chamber);
00151 int order = 0 ;
00152 for (set<ChannelHit*,sorter>::iterator iter=list.begin(); iter!=list.end(); iter++)
00153 {
00154 try
00155 {
00156
00157 ChannelHit& channelHit = *(*iter);
00158 if ( chamber.getType().find("GASSIPLEX")!=string::npos)
00159 {
00160 channelHit.setTimestamp(aEvent.getTimeStamp());
00161 }
00162
00163
00164 MTChannel *ch = this->AddChannel(channelHit, order);
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177 order++;
00178 }
00179 catch (MicroException e)
00180 {
00181 }
00182 }
00183 }
00184 catch (MicroException e)
00185 {
00186
00187 }
00188 }
00189 this->GetChannels()->Sort();
00190 }
00191 catch (MicroException e)
00192 {
00193 throw MicroException(e.getMessage());
00194 }
00195
00196 return *this;
00197
00198 }
00199
00200
00201 bool MTEvent::IsSquare(UInt_t nbPad, UInt_t &asu, UInt_t &abs_time, UInt_t chb)
00202
00203
00204 {
00205
00206 bool square = false;
00207
00208 asu = -1;
00209 abs_time = -1;
00210
00211
00212 map<unsigned int,map<unsigned int,int> > channels_map;
00213
00214
00215 UInt_t nchannel = this->GetNchannel();
00216 for (int j=0;j<nchannel;j++){
00217
00218
00219 MTChannel* channel = (MTChannel*)this->GetChannels()->UncheckedAt(j);
00220
00221 if (channel->GetChamberId()==chb)
00222 {
00223
00224 UInt_t hit_time = channel->GetBcIdAbs() - (channel->GetBcIdDif() - channel->GetBcIdHit() );
00225 UInt_t board_id = channel->GetBoardId();
00226
00227
00228
00229 if ( channels_map.find(board_id) == channels_map.end()) {
00230
00231 map<unsigned int, int> nbHitMap;
00232 nbHitMap[hit_time]=1;
00233 channels_map.insert(make_pair(board_id,nbHitMap));
00234 }
00235
00236 else{
00237
00238 map<unsigned int, int> &nbHitMap = channels_map.find(board_id)->second;
00239
00240 if (nbHitMap.find(hit_time) == nbHitMap.end()){
00241
00242 nbHitMap.insert(make_pair(hit_time,1));
00243 }
00244
00245 else{
00246
00247 nbHitMap[hit_time] = nbHitMap[hit_time]++;
00248 }
00249 }
00250 }
00251 }
00252
00253
00254 map<unsigned int, map<unsigned int,int> >::iterator iter1;
00255 for(iter1=channels_map.begin();iter1!=channels_map.end();iter1++){
00256
00257 unsigned int azu=iter1->first;
00258 map<unsigned int,int> hits_per_time=iter1->second;
00259
00260 map<unsigned int,int>::iterator iter2;
00261 for(iter2=hits_per_time.begin();iter2!=hits_per_time.end();iter2++){
00262
00263 unsigned int time = iter2->first;
00264 int nb_hits = iter2->second;
00265
00266
00267 if (nb_hits>=nbPad) {
00268 square=true;
00269 asu = azu;
00270 abs_time = time;
00271 }
00272 }
00273 }
00274 return square;
00275 }
00276
00277
00278 bool MTEvent::IsBorder(UInt_t nbPad, UInt_t &asu, UInt_t &abs_time, UInt_t chb)
00279
00280
00281 {
00282
00283 bool border = false;
00284
00285 asu = -1;
00286 abs_time = -1;
00287
00288
00289 UInt_t A;
00290 UInt_t T;
00291 if(this->IsSquare(450,A,T,chb)==0) {
00292
00293 map<unsigned int,map<unsigned long,unsigned int> > channels_map;
00294
00295
00296 UInt_t nchannel = this->GetNchannel();
00297 for (unsigned int j=0;j<nchannel;j++){
00298
00299
00300 MTChannel* channel = (MTChannel*)this->GetChannels()->UncheckedAt(j);
00301
00302 if (channel->GetChamberId()==chb)
00303 {
00304
00305 ULong_t hit_time = channel->GetBcIdAbs() - (channel->GetBcIdDif() - channel->GetBcIdHit() );
00306 UInt_t board_id = channel->GetBoardId();
00307
00308
00309
00310
00311
00312
00313 if (channel->GetX() != 0000 && channel->GetX() != 310000 && channel->GetX() != 320000 && channel->GetX() != 640000 && channel->GetX() != 650000 && channel->GetX() != 960000 && channel->GetY() != 000000 && channel->GetY() != 470000 && channel->GetY() != 480000 && channel->GetY() != 960000) continue;
00314
00315
00316 if (channels_map.find(board_id) == channels_map.end()) {
00317
00318 map<unsigned long, unsigned int> nbHitMap;
00319 nbHitMap[hit_time]=1;
00320 channels_map.insert(make_pair(board_id,nbHitMap));
00321 }
00322 else{
00323
00324 map<unsigned long, unsigned int> &nbHitMap = channels_map.find(board_id)->second;
00325 if (nbHitMap.find(hit_time) == nbHitMap.end()){
00326
00327 nbHitMap.insert(make_pair(hit_time,1));
00328 }
00329 else{
00330
00331 nbHitMap[hit_time] = nbHitMap[hit_time]++;
00332 }
00333 }
00334 }
00335
00336
00337 map<unsigned int, map<unsigned long,unsigned int> >::iterator iter1;
00338 for(iter1=channels_map.begin();iter1!=channels_map.end();iter1++){
00339
00340 unsigned int azu=iter1->first;
00341 map<unsigned long,unsigned int> hits_per_time=iter1->second;
00342
00343 map<unsigned long,unsigned int>::iterator iter2;
00344 for(iter2=hits_per_time.begin();iter2!=hits_per_time.end();iter2++){
00345
00346 unsigned long time = iter2->first;
00347 unsigned int nb_hits = iter2->second;
00348
00349
00350 if (nb_hits>=nbPad) {
00351 border = true;
00352 asu = azu;
00353 abs_time = time;
00354 }
00355 }
00356 }
00357 }
00358 }
00359 return border;
00360 }
00361
00362
00363 bool MTEvent::IsChip(UInt_t nbPad, UInt_t &chip, UInt_t &abs_time, UInt_t chb)
00364
00365
00366 {
00367
00368 bool me_chip = false;
00369
00370 chip = -1;
00371 abs_time = -1;
00372
00373
00374 map<unsigned int,map<unsigned long,unsigned int> > channels_map;
00375
00376
00377 UInt_t nchannel = this->GetNchannel();
00378 for (unsigned int j=0;j<nchannel;j++){
00379
00380
00381 MTChannel* channel = (MTChannel*)this->GetChannels()->UncheckedAt(j);
00382
00383 if (channel->GetChamberId()==chb)
00384 {
00385
00386 ULong_t hit_time = channel->GetBcIdAbs() - (channel->GetBcIdDif() - channel->GetBcIdHit() );
00387 UInt_t chip_id = channel->GetChipId();
00388
00389
00390
00391
00392
00393
00394 if (channel->GetX() != 0000 && channel->GetX() != 310000 && channel->GetX() != 320000 && channel->GetX() != 640000 && channel->GetX() != 650000 && channel->GetX() != 960000 && channel->GetY() != 000000 && channel->GetY() != 470000 && channel->GetY() != 480000 && channel->GetY() != 960000) continue;
00395
00396
00397 if (channels_map.find(chip_id) == channels_map.end()) {
00398
00399 map<unsigned long, unsigned int> nbHitMap;
00400 nbHitMap[hit_time]=1;
00401 channels_map.insert(make_pair(chip_id,nbHitMap));
00402 }
00403 else{
00404
00405 map<unsigned long, unsigned int> &nbHitMap = channels_map.find(chip_id)->second;
00406 if (nbHitMap.find(hit_time) == nbHitMap.end()){
00407
00408 nbHitMap.insert(make_pair(hit_time,1));
00409 }
00410 else{
00411
00412 nbHitMap[hit_time] = nbHitMap[hit_time]++;
00413 }
00414 }
00415 }
00416
00417
00418 map<unsigned int, map<unsigned long,unsigned int> >::iterator iter1;
00419 for(iter1=channels_map.begin();iter1!=channels_map.end();iter1++){
00420
00421 unsigned int chiip=iter1->first;
00422 map<unsigned long,unsigned int> hits_per_time=iter1->second;
00423
00424 map<unsigned long,unsigned int>::iterator iter2;
00425 for(iter2=hits_per_time.begin();iter2!=hits_per_time.end();iter2++){
00426
00427 unsigned long time = iter2->first;
00428 unsigned int nb_hits = iter2->second;
00429
00430
00431 if (nb_hits>=nbPad) {
00432 me_chip = true;
00433 chip = chiip;
00434 abs_time = time;
00435 }
00436 }
00437 }
00438 }
00439 return me_chip;
00440 }
00441
00442
00443 Float_t MTEvent::GetMeshVoltage(const Int_t chamberId,Int_t difId, Int_t boardId) const
00444 {
00445 if ( fMeshVoltage.find(chamberId) != fMeshVoltage.end())
00446 {
00447 map<UInt_t, map<UInt_t, Float_t>* >* difContainer = fMeshVoltage.find(chamberId)->second;
00448 if (difContainer->find(difId) != difContainer->end())
00449 {
00450 map<UInt_t , Float_t>* boardContainer = difContainer->find(difId)->second;
00451 if (boardContainer->find(boardId) != boardContainer->end())
00452 {
00453 return boardContainer->find(boardId)->second;
00454 }
00455 else
00456 {
00457 throw MicroException("MTEvent::GetMeshVoltage : no board found");
00458 }
00459 }
00460 else
00461 {
00462 throw MicroException("MTEvent::GetMeshVoltage : no board found");
00463 }
00464 }
00465 else
00466 {
00467 }
00468 {
00469 throw MicroException("MTEvent::GetMeshVoltage : no board found");
00470 }
00471
00472 }
00473
00474 Float_t MTEvent::GetDriftVoltage(const Int_t chamberId,Int_t difId, Int_t boardId) const
00475 {
00476 if ( fDriftVoltage.find(chamberId) != fDriftVoltage.end())
00477 {
00478 map<UInt_t, map<UInt_t, Float_t>* >* difContainer = fDriftVoltage.find(chamberId)->second;
00479 if (difContainer->find(difId) != difContainer->end())
00480 {
00481 map<UInt_t , Float_t>* boardContainer = difContainer->find(difId)->second;
00482 if (boardContainer->find(boardId) != boardContainer->end())
00483 {
00484 return boardContainer->find(boardId)->second;
00485 }
00486 else
00487 {
00488 throw MicroException("MTEvent::GetDriftVoltage : no board found");
00489 }
00490 }
00491 else
00492 {
00493 throw MicroException("MTEvent::GetDriftVoltage : no board found");
00494 }
00495 }
00496 else
00497 {
00498 throw MicroException("MTEvent::GetDriftVoltage : no board found");
00499 }
00500
00501
00502
00503 }
00504
00505 void MTEvent::SetMeshVoltage(const Int_t chamberId, Int_t difId, Int_t boardId,const Float_t aValue)
00506 {
00507
00508 if ( fMeshVoltage.find(chamberId) != fMeshVoltage.end())
00509 {
00510 }
00511 else
00512 {
00513 map<UInt_t , map<UInt_t, Float_t>* > *difContainer = new map<UInt_t, map<UInt_t, Float_t>* >();
00514 fMeshVoltage.insert(make_pair(chamberId,difContainer));
00515 }
00516
00517
00518 map<UInt_t, map<UInt_t, Float_t>* >* difContainer = fMeshVoltage.find(chamberId)->second;
00519
00520
00521
00522 if ( difContainer->find(difId) != difContainer->end())
00523 {
00524 }
00525 else
00526 {
00527 map<UInt_t, Float_t>* boardContainer = new map<UInt_t, Float_t>();
00528 difContainer->insert(make_pair(difId,boardContainer));
00529 }
00530
00531
00532 map<ui32, Float_t>* boardContainer = difContainer->find(difId)->second;
00533
00534 if ( boardContainer->find(boardId) != boardContainer->end())
00535 {
00536 (*boardContainer)[boardId] = aValue;
00537 }
00538 else
00539 {
00540 boardContainer->insert(make_pair(boardId,aValue));
00541 }
00542 }
00543
00544
00545 void MTEvent::SetDriftVoltage(const Int_t chamberId, Int_t difId, Int_t boardId,const Float_t aValue)
00546 {
00547
00548 if ( fDriftVoltage.find(chamberId) != fDriftVoltage.end())
00549 {
00550 }
00551 else
00552 {
00553 map<UInt_t , map<UInt_t, Float_t>* > *difContainer = new map<UInt_t, map<UInt_t, Float_t>* >();
00554 fDriftVoltage.insert(make_pair(chamberId,difContainer));
00555 }
00556
00557
00558 map<UInt_t, map<UInt_t, Float_t>* >* difContainer = fDriftVoltage.find(chamberId)->second;
00559
00560
00561
00562 if ( difContainer->find(difId) != difContainer->end())
00563 {
00564 }
00565 else
00566 {
00567 map<UInt_t, Float_t>* boardContainer = new map<UInt_t, Float_t>();
00568 difContainer->insert(make_pair(difId,boardContainer));
00569 }
00570
00571
00572 map<ui32, Float_t>* boardContainer = difContainer->find(difId)->second;
00573 if ( boardContainer->find(boardId) != boardContainer->end())
00574 {
00575 (*boardContainer)[boardId] = aValue;
00576 }
00577 else
00578 {
00579 boardContainer->insert(make_pair(boardId,aValue));
00580 }
00581
00582
00583
00584
00585
00586 }
00587
00588
00589
00590 MTChannel* MTEvent::AddChannel(const ChannelHit& hit, UInt_t order) {
00591
00592
00593
00594
00595
00596
00597
00598
00599
00600 TClonesArray &channels = *fChannels;
00601
00602 MTChannel *channel = new(channels[fNchannel++]) MTChannel(hit, order);
00603 UInt_t bcIdHit = channel->GetBcIdHit();
00604 if ( bcIdHit != 0 )
00605 {
00606 UInt_t boardId = channel->GetSoftId().GetBoardId();
00607 UInt_t absolute_time = channel->GetAbsTime() ;
00608 this->AddHitForAbsTime(boardId,absolute_time,1);
00609 }
00610
00611 return channel;
00612 }
00613
00614 MTChannel* MTEvent::AddChannel(MTChannel* aChannel) {
00615
00616
00617
00618
00619
00620
00621
00622
00623
00624 TClonesArray &channels = *fChannels;
00625 MTChannel *channel = new(channels[fNchannel++]) MTChannel(*aChannel);
00626 UInt_t bcIdHit = channel->GetBcIdHit();
00627 if ( bcIdHit != 0 )
00628 {
00629 UInt_t boardId = channel->GetSoftId().GetBoardId();
00630 UInt_t absolute_time = channel->GetAbsTime();
00631 this->AddHitForAbsTime(boardId,absolute_time,1);
00632
00633 }
00634
00635
00636
00637
00638 return aChannel;
00639 }
00640
00641
00642 void MTEvent::Clear(Option_t * )
00643 {
00644 fChannels->Clear("C");
00645 fNchannel = 0;
00646
00647 for (std::map< UInt_t, std::map<UInt_t, UInt_t>* >::iterator iter = fNbHitPerAbsTime.begin(); iter != fNbHitPerAbsTime.end(); iter++)
00648 {
00649 map<UInt_t, UInt_t> *byBoard = iter->second;
00650 delete byBoard;
00651 }
00652 fNbHitPerAbsTime.clear();
00653 }
00654
00655
00656
00657 void MTEvent::Reset(Option_t * )
00658 {
00659
00660
00661
00662 delete fgChannels; fgChannels = 0;
00663 }
00664
00665
00666 void MTEvent::SetNchannel(Int_t n) {
00667 fNchannel = n;
00668 if ( fNchannel == 0 )
00669 { fgChannels->Delete(); }
00670 }
00671
00672
00673
00674
00675 MTChannel* MTEvent::GetChannelByOrder(UInt_t order,UInt_t aChamberId) const
00676 {
00677 UInt_t items = 0;
00678
00679 TIter myiter(fChannels);
00680 MTChannel* channel;
00681 while( channel=(MTChannel *)myiter.Next())
00682 {
00683 if ( channel->GetChamberId() == aChamberId )
00684 {
00685 if ( order == items )
00686 {
00687 return channel;
00688 }
00689 items++;
00690 }
00691 }
00692 return NULL;
00693
00694
00695 }
00696
00697
00698 UInt_t MTEvent::GetNchannel(UInt_t aChamberId) const
00699 {
00700 UInt_t items = 0;
00701
00702 TIter myiter(fChannels);
00703 MTChannel* channel;
00704 while( channel=(MTChannel *)myiter.Next())
00705 {
00706 if ( channel->GetChamberId() == aChamberId )
00707 {
00708 items++;
00709 }
00710 }
00711 return items;
00712 }
00713
00714
00715 void MTEvent::AddHitForAbsTime(UInt_t boardId, UInt_t abs_time, UInt_t increment)
00716 {
00717
00718 map<UInt_t, UInt_t>* boardMap = NULL;
00719
00720
00721 if ( fNbHitPerAbsTime.find(boardId) != fNbHitPerAbsTime.end())
00722 {
00723 boardMap = fNbHitPerAbsTime.find(boardId)->second;
00724 }
00725 else
00726 {
00727 boardMap = new map<UInt_t, UInt_t>();
00728 fNbHitPerAbsTime.insert(make_pair(boardId,boardMap));
00729 }
00730
00731
00732
00733 if (boardMap->find(abs_time) != boardMap->end())
00734 {
00735 UInt_t b4 = boardMap->find(abs_time)->second;
00736 UInt_t foo = b4 + increment;
00737 (*boardMap)[abs_time]=foo;
00738 }
00739 else
00740 {
00741 boardMap->insert(make_pair(abs_time,increment));
00742 }
00743
00744
00745 boardMap = fNbHitPerAbsTime.find(boardId)->second;
00746
00747
00748 }
00749
00750
00751 UInt_t MTEvent::GetNbHitPerAbsTime(UInt_t boardId,UInt_t abs_time) const
00752 {
00753 map<UInt_t, UInt_t>* boardMap = NULL;
00754
00755 if ( fNbHitPerAbsTime.find(boardId) != fNbHitPerAbsTime.end())
00756 {
00757 boardMap = fNbHitPerAbsTime.find(boardId)->second;
00758 return boardMap->find(abs_time)->second;
00759 }
00760
00761 else
00762 {
00763 return 0;
00764 }
00765
00766 }
00767
00768
00769 bool MTEvent::IsValid(void) const
00770 {
00771
00772 if (( fValid & VALID ) == VALID )return true;
00773 return false;
00774 }
00775
00776
00777 void MTEvent::SetTemperatureAsu1(UInt_t difId,Float_t asu1)
00778 {
00779 if ( fTemperatureAsu1.find(difId) != fTemperatureAsu1.end())
00780 {
00781 fTemperatureAsu1[difId] = asu1;
00782 }
00783 else
00784 {
00785 fTemperatureAsu1.insert(make_pair(difId,asu1));
00786 }
00787 }
00788
00789 void MTEvent::SetTemperatureAsu2(UInt_t difId,Float_t asu2)
00790 {
00791 if ( fTemperatureAsu2.find(difId) != fTemperatureAsu2.end())
00792 {
00793 fTemperatureAsu2[difId] = asu2;
00794 }
00795 else
00796 {
00797 fTemperatureAsu2.insert(make_pair(difId,asu2));
00798 }
00799 }
00800
00801 void MTEvent::SetTemperatureDif(UInt_t difId,Float_t dif)
00802 {
00803 if ( fTemperatureDif.find(difId) != fTemperatureDif.end())
00804 {
00805 fTemperatureDif[difId] = dif;
00806 }
00807 else
00808 {
00809 fTemperatureDif.insert(make_pair(difId,dif));
00810 }
00811 }
00812
00813
00814 void MTEvent::SetTemperature(UInt_t difId,Float_t asu1, Float_t asu2, Float_t dif)
00815 {
00816
00817 if ( fTemperatureAsu1.find(difId) != fTemperatureAsu1.end())
00818 {
00819 fTemperatureAsu1[difId] = asu1;
00820 }
00821 else
00822 {
00823 fTemperatureAsu1.insert(make_pair(difId,asu1));
00824 }
00825
00826 if ( fTemperatureAsu2.find(difId) != fTemperatureAsu2.end())
00827 {
00828 fTemperatureAsu2[difId] = asu2;
00829 }
00830 else
00831 {
00832 fTemperatureAsu2.insert(make_pair(difId,asu2));
00833 }
00834
00835 if ( fTemperatureDif.find(difId) != fTemperatureDif.end())
00836 {
00837 fTemperatureDif[difId] = dif;
00838 }
00839 else
00840 {
00841 fTemperatureDif.insert(make_pair(difId,dif));
00842 }
00843 }
00844
00845 Float_t MTEvent::GetTemperatureAsu1( UInt_t difId ) const
00846 {
00847 if ( fTemperatureAsu1.find(difId) != fTemperatureAsu1.end())
00848 {
00849 return fTemperatureAsu1.find(difId)->second;
00850 }
00851 else
00852 {
00853 throw MicroException("MTEvent::GetTemperatureAsu1 : no difId found");
00854 }
00855 }
00856
00857 Float_t MTEvent::GetTemperatureAsu2( UInt_t difId ) const
00858 {
00859 if ( fTemperatureAsu2.find(difId) != fTemperatureAsu2.end())
00860 {
00861 return fTemperatureAsu2.find(difId)->second;
00862 }
00863 else
00864 {
00865 throw MicroException("MTEvent::GetTemperatureAsu2 : no difId found");
00866 }
00867 }
00868
00869 Float_t MTEvent::GetTemperatureDif( UInt_t difId ) const
00870 {
00871 if ( fTemperatureDif.find(difId) != fTemperatureDif.end())
00872 {
00873 return fTemperatureDif.find(difId)->second;
00874 }
00875 else
00876 {
00877 throw MicroException("MTEvent::GetTemperatureDif : no difId found");
00878 }
00879 }
00880
00881
00882 void MTEvent::SetValidFlag(UInt_t value,bool valid )
00883 {
00884 fValid = fValid | fValid;
00885 if ( ! valid ) { fValid = fValid & 0xFFFE ; }
00886 }
00887
00888
00889 TString MTEvent::GetValidFlagString(void ) const
00890 {
00891 TString result;
00892 if ( fValid == VALID ) { return "Valid" ;}
00893 if ( (fValid & UNKNOW_NOT_VALID ) == UNKNOW_NOT_VALID ) { result = result + " " + "UNKNOW_NOT_VALID" ;}
00894 if ( (fValid & BAD_CHIP_ID ) == BAD_CHIP_ID ) { result = result + " " + "BAD_CHIP_ID" ;}
00895 if ( (fValid & BAD_BOARD_ID ) == BAD_BOARD_ID ) { result = result + " " + "BAD_BOARD_ID" ;}
00896 if ( (fValid & BAD_DIF_ID ) == BAD_DIF_ID ) { result = result + " " + "BAD_DIF_ID" ;}
00897 if ( (fValid & CRC_ERROR ) == CRC_ERROR ) { result = result + " " + "CRC_ERROR" ;}
00898 if ( (fValid & ONLY_FFFF) == ONLY_FFFF ) { result = result + " " + "ONLY_FFFF" ;}
00899 if ( (fValid & ONLY_AAAA) == ONLY_AAAA ) { result = result + " " + "ONLY_AAAA" ;}
00900 if ( (fValid & ONLY_5555) == ONLY_5555 ) { result = result + " " + "ONLY_5555" ;}
00901 if ( (fValid & GLOBAL_HEADER_ERROR) == GLOBAL_HEADER_ERROR ) { result = result + " " + "GLOBAL_HEADER_ERROR" ;}
00902 if ( (fValid & FRAME_HEADER_ERROR) == FRAME_HEADER_ERROR ) { result = result + " " + "FRAME_HEADER_ERROR" ;}
00903 if ( (fValid & TRAILER_C3_FOUND) == TRAILER_C3_FOUND ) { result = result + " " + "TRAILER_C3_FOUND" ;}
00904 if ( (fValid & END_OF_FILE_ERROR) == END_OF_FILE_ERROR ) { result = result + " " + "END_OF_FILE_ERROR" ;}
00905
00906
00907 return result;
00908 }
00909