24 Hit::Hit() : index(-1), detectorID(-1), flag(0)
 
  109     for(
int i=0; i<33; ++i) fIntensity[i] = c->
getIntensity(i);
 
  112     for(
int i=0; i<4; ++i)  fNRoads[i]    = c->
getNRoads()[i];
 
  134     fAllHits.push_back(h);
 
  143     if(elementID < 0) 
return -1;
 
  155     for(
int i = 1; i < detectorID; ++i) idx_start += fNHits[i];
 
  156     Int_t idx_end = idx_start + fNHits[detectorID];
 
  157     while(idx_start <= idx_end)
 
  159         Int_t idx_mid = Int_t((idx_start + idx_end)/2);
 
  160         if(fAllHits[idx_mid].elementID == elementID)
 
  164         else if(fAllHits[idx_mid].elementID < elementID)
 
  166             idx_start = idx_mid + 1;
 
  170             idx_end = idx_mid - 1;
 
  179     Int_t hitID = 
findHit(detectorID, elementID);
 
  180     if(hitID >= 0) 
return getHit(hitID);
 
  188     std::list<Int_t> hit_list;
 
  191     for(Int_t i = 0; i < fNHits[0]; i++)
 
  193         if(fAllHits[i].detectorID != detectorID) 
continue;
 
  195         hit_list.push_back(i);
 
  204     std::list<Int_t> hit_list;
 
  207     for(Int_t i = 0; i < fNHits[0]; i++)
 
  209         if(fAllHits[i].detectorID != detectorID) 
continue;
 
  210         if(fabs(fAllHits[i].pos - x_exp) > win) 
continue;
 
  212         hit_list.push_back(i);
 
  220     std::list<Int_t> hit_list;
 
  223     for(Int_t i = 0; i < fNHits[0]; i++)
 
  225         if((fAllHits[i].detectorID != 2*detectorID) && (fAllHits[i].detectorID != 2*detectorID-1)) 
continue;
 
  227         hit_list.push_back(i);
 
  235     std::list<Int_t> hit_list;
 
  238     UInt_t nDetectors = detectorIDs.size();
 
  239     for(Int_t i = 0; i < fNHits[0]; i++)
 
  241         for(UInt_t j = 0; j < nDetectors; j++)
 
  243             if(fAllHits[i].detectorID == detectorIDs[j])
 
  245                 hit_list.push_back(i);
 
  256     std::list<SRawEvent::hit_pair> _hitpairs;
 
  260     std::vector<int> _hitflag1(_hitlist1.size(), -1);
 
  261     std::vector<int> _hitflag2(_hitlist2.size(), -1);
 
  265                          {0., 0.40, 0.40, 0.40, 0.40, 0.40, 0.40, 1.3, 1.3, 1.3, 1.2, 1.2, 1.2, 1.2, 1.2, 1.2,  
 
  266                           4.0, 4.0, 7.0, 7.0, 8.0, 12.0, 12.0, 10.0,                          
 
  271     for(std::list<int>::iterator iter = _hitlist1.begin(); iter != _hitlist1.end(); ++iter)
 
  275         for(std::list<int>::iterator jter = _hitlist2.begin(); jter != _hitlist2.end(); ++jter)
 
  278             if(fabs(fAllHits[*iter].pos - fAllHits[*jter].pos) > spacing[detectorID]) 
continue;
 
  279             _hitpairs.push_back(std::make_pair(*iter, *jter));
 
  281             _hitflag1[index1] = 1;
 
  282             _hitflag2[index2] = 1;
 
  287     for(std::list<int>::iterator iter = _hitlist1.begin(); iter != _hitlist1.end(); ++iter)
 
  289         if(_hitflag1[index1] < 0) _hitpairs.push_back(std::make_pair(*iter, -1));
 
  294     for(std::list<int>::iterator iter = _hitlist2.begin(); iter != _hitlist2.end(); ++iter)
 
  296         if(_hitflag2[index2] < 0) _hitpairs.push_back(std::make_pair(*iter, -1));
 
  305     std::list<SRawEvent::hit_pair> _hitpairs;
 
  309     std::vector<int> _hitflag1(_hitlist1.size(), -1);
 
  310     std::vector<int> _hitflag2(_hitlist2.size(), -1);
 
  314                          {0., 0.40, 0.40, 0.40, 0.40, 0.40, 0.40, 1.3, 1.3, 1.3, 1.2, 1.2, 1.2, 1.2, 1.2, 1.2,  
 
  315                           4.0, 4.0, 7.0, 7.0, 8.0, 12.0, 12.0, 10.0,                          
 
  320     for(std::list<int>::iterator iter = _hitlist1.begin(); iter != _hitlist1.end(); ++iter)
 
  324         for(std::list<int>::iterator jter = _hitlist2.begin(); jter != _hitlist2.end(); ++jter)
 
  327             if(fabs(fAllHits[*iter].pos - fAllHits[*jter].pos) > spacing[detectorID]) 
continue;
 
  328             _hitpairs.push_back(std::make_pair(*iter, *jter));
 
  330             _hitflag1[index1] = 1;
 
  331             _hitflag2[index2] = 1;
 
  336     for(std::list<int>::iterator iter = _hitlist1.begin(); iter != _hitlist1.end(); ++iter)
 
  338         if(_hitflag1[index1] < 0) _hitpairs.push_back(std::make_pair(*iter, -1));
 
  343     for(std::list<int>::iterator iter = _hitlist2.begin(); iter != _hitlist2.end(); ++iter)
 
  345         if(_hitflag2[index2] < 0) _hitpairs.push_back(std::make_pair(*iter, -1));
 
  354     std::list<Int_t> hit_list;
 
  358     Short_t detectorID_adj;
 
  359     if((detectorID/2)*2 == detectorID)
 
  361         detectorID_adj = detectorID - 1;
 
  365         detectorID_adj = detectorID + 1;
 
  368     for(Int_t i = 0; i < fNHits[0]; i++)
 
  370         if(fAllHits[i].detectorID == detectorID_adj && abs(fAllHits[i].elementID - _hit.
elementID) <= 1)
 
  372             hit_list.push_back(i);
 
  417     UInt_t nDetectors = detectorIDs.size();
 
  418     for(UInt_t i = 0; i < nDetectors; i++)
 
  422             if(detectorIDs[i] == j)
 
  436     for(Int_t i = 1; i <= 6; i++)
 
  447     for(Int_t i = 7; i <= 12; i++)
 
  458     for(Int_t i = 13; i <= 18; i++)
 
  474     for(Int_t i = 19; i <= 24; i++)
 
  485     for(Int_t i = 25; i <= 30; i++)
 
  561     if(doSort) std::sort(fAllHits.begin(), fAllHits.end());
 
  565     for(UInt_t i = 0; i < fAllHits.size(); i++) ++fNHits[fAllHits[i].detectorID];
 
  567     fNHits[0] = fAllHits.size();
 
  572     fAllHits.insert(fAllHits.end(), event.fAllHits.begin(), event.fAllHits.end());
 
  573     fTriggerHits.insert(fTriggerHits.end(), event.fTriggerHits.begin(), event.fTriggerHits.end());
 
  575     fTurnID = 
event.fTurnID;
 
  577     for(
int i = 0; i < 33; ++i) fIntensity[i] = event.fIntensity[i];
 
  579     fTargetPos = event.fTargetPos;
 
  615     for(
int i = 0; i < 4; ++i) fNRoads[i] = 0;
 
  619     for(
int i = 0; i < 33; ++i) fIntensity[i] = -1;
 
  622     fTriggerHits.clear();
 
  628     for(
int i = 0; i < 10; ++i)
 
  630         if(triggers[i] == 0) 
continue;
 
  647     os << 
"RunID: " << fRunID << 
", EventID: " << fEventID << 
"===============" << std::endl;
 
  650         os << 
"Layer " << i << 
" has " << fNHits[i] << 
" hits." << std::endl;
 
  652     os << 
"===================================================================" << std::endl;
 
  655     for(
auto iter = fAllHits.begin(); iter != fAllHits.end(); ++iter)
 
  659     os << 
"===================================================================" << std::endl;
 
#define nDarkPhotonPlanes
ClassImp(Hit) ClassImp(SRawEvent) Hit
Definition of hit structure.
Int_t getElementID(Int_t uniqueID)
Int_t getDetectorID(Int_t uniqueID)
bool operator==(const Hit &elem) const
bool operator<(const Hit &elem) const
void clear()
Clear the internal event structure.
void reIndex(bool doSort=false)
Reset the number hits on each plane.
void setTurnID(Int_t turnID)
void mergeEvent(const SRawEvent &rawEvent)
Merge a event to this event.
std::vector< Hit > & getTriggerHits()
void setTargetPos(Short_t targetPos)
std::list< Int_t > getHitsIndexInDetectors(std::vector< Int_t > &detectorIDs)
Int_t * getIntensityAll()
std::list< SRawEvent::hit_pair > getPartialHitPairsInSuperDetector(Short_t detectorID)
void setTriggerEmu(bool flag)
void setTriggerBits(Int_t triggers[])
void insertHit(Hit h)
Insert a new hit.
Int_t getTriggerBits()
Set/get the trigger types.
void setNRoads(Short_t nRoads[])
Int_t getNHitsInDetector(Short_t detectorID)
std::list< Int_t > getHitsIndexInSuperDetector(Short_t detectorID)
void print(std::ostream &os=std::cout) const
Print for debugging purposes.
void setIntensity(const Int_t intensity[])
std::vector< Hit > & getAllHits()
std::list< Int_t > getHitsIndexInDetector(Short_t detectorID)
Gets.
std::list< Int_t > getAdjacentHitsIndex(Hit &_hit)
void DeepClone(SRawEvent *c)
Int_t getNChamberHitsAll()
void setEventInfo(Int_t runID, Int_t spillID, Int_t eventID)
Sets.
Int_t getNHitsInDetectors(std::vector< Int_t > &detectorIDs)
Int_t findHit(Short_t detectorID, Short_t elementID)
Find a hit – binary search since hit list is sorted.
bool isTriggeredBy(Int_t trigger)