117 for( i = 0; i < nLines; ++i){
123 std::list<RegSelectorMapElement>::iterator it;
126 (*it).findMaxMinElem();
128 (*it).findMaxMinElem();
130 (*it).findMaxMinElem();
140 double etaminIn,
double etamaxIn,
141 double phiminIn,
double phimaxIn,
142 std::vector<uint32_t>& outList )
const {
146 std::list<RegSelectorMapElement>::const_iterator it;
147 std::set<uint32_t> outset;
148 std::set<uint32_t>::const_iterator itset, negbarrelbeg, negbarrelend;
149 bool divideEta =
false;
153 (*it).selectionRobIdUint( etaminIn, etamaxIn, phiminIn, phimaxIn, outset );
157 case TILE: divideEta =
true;
break;
162 if(etaminIn < 0 || etamaxIn < 0){
164 (*it).selectionRobIdUint(etaminIn, etamaxIn, phiminIn, phimaxIn, outset);
168 if( etaminIn >= 0 || etamaxIn >= 0 ){
170 (*it).selectionRobIdUint(etaminIn, etamaxIn, phiminIn, phimaxIn, outset);
176 (*it).selectionRobIdUint(etaminIn, etamaxIn, phiminIn, phimaxIn, outset);
179 (*it).selectionRobIdUint(etaminIn, etamaxIn, phiminIn, phimaxIn, outset);
184 negbarrelbeg = outset.upper_bound(0x51000f);
185 negbarrelend = outset.lower_bound(0x530000);
186 for(itset = negbarrelbeg; itset != negbarrelend; ++itset){
187 outList.push_back(*itset);
189 for(itset = outset.begin(); itset != negbarrelbeg; ++itset){
190 outList.push_back(*itset);
192 for(itset = negbarrelend; itset != outset.end(); ++itset){
193 outList.push_back(*itset);
196 for(itset = outset.begin(); itset != outset.end(); ++itset){
197 outList.push_back(*itset);
206 for(
size_t i=0; i< detLut->
maxHash(); ++i) {
221 double etaminIn,
double etamaxIn,
222 double phiminIn,
double phimaxIn,
223 std::vector<IdentifierHash>& outList)
const {
227 std::list<RegSelectorMapElement>::const_iterator it;
228 std::set<IdentifierHash> outset;
229 std::set<IdentifierHash>::const_iterator itset, negbarrelbeg,negbarrelend;
230 bool divideEta =
false;
234 (*it).selection(etaminIn, etamaxIn, phiminIn, phimaxIn, outset);
238 case TILE: divideEta =
true;
break;
243 if(etaminIn < 0 || etamaxIn < 0){
245 (*it).selection(etaminIn, etamaxIn, phiminIn, phimaxIn, outset);
249 if( etaminIn >= 0 || etamaxIn >= 0 ){
251 (*it).selection(etaminIn, etamaxIn, phiminIn, phimaxIn, outset);
257 (*it).selection(etaminIn, etamaxIn, phiminIn, phimaxIn, outset);
260 (*it).selection(etaminIn, etamaxIn, phiminIn, phimaxIn, outset);
265 negbarrelbeg = outset.upper_bound(0x3f);
266 negbarrelend = outset.lower_bound(0x80);
267 for(itset = negbarrelbeg; itset != negbarrelend; ++itset){
268 outList.push_back(*itset);
270 for(itset = outset.begin(); itset != negbarrelbeg; ++itset){
271 outList.push_back(*itset);
273 for(itset = negbarrelend; itset != outset.end(); ++itset){
274 outList.push_back(*itset);
277 for(itset = outset.begin(); itset != outset.end(); ++itset){
278 outList.push_back(*itset);
285 double etaminIn,
double etamaxIn,
286 double phiminIn,
double phimaxIn,
287 std::vector<IdentifierHash>& outList)
const {
291 std::list<RegSelectorMapElement>::const_iterator it;
292 std::set<IdentifierHash> outset;
293 std::set<IdentifierHash>::const_iterator itset;
297 if( etaminIn > 0 && etamaxIn > 0 ){
300 (*it).selection( etaminIn, etamaxIn, phiminIn, phimaxIn, outset);
302 else if( etaminIn < 0 && etamaxIn < 0 ){
305 (*it).selection( etaminIn, etamaxIn, phiminIn, phimaxIn, outset);
310 (*it).selection( etaminIn, etamaxIn, phiminIn, phimaxIn, outset);
313 (*it).selection( etaminIn, etamaxIn, phiminIn, phimaxIn, outset);
316 for(itset = outset.begin(); itset != outset.end(); ++itset){
317 outList.push_back(*itset);
324 double etaminIn,
double etamaxIn,
325 double phiminIn,
double phimaxIn,
326 std::vector<IdentifierHash>& outList)
const {
330 std::list<RegSelectorMapElement>::const_iterator it, itEnd;
331 std::set<IdentifierHash> outset;
332 std::set<IdentifierHash>::const_iterator itset;
336 if( etaminIn > 0 && etamaxIn > 0 ){
339 (*it).selection( etaminIn, etamaxIn, phiminIn, phimaxIn, outset);
341 else if( etaminIn < 0 && etamaxIn < 0 ){
344 (*it).selection( etaminIn, etamaxIn, phiminIn, phimaxIn, outset);
352 if( (*it).layerDiskNumber() == layNumber ) {
353 (*it).selection( etaminIn, etamaxIn, phiminIn, phimaxIn, outset);
359 for(itset = outset.begin(); itset != outset.end(); ++itset){
360 outList.push_back(*itset);
367 StatusCode
sc = StatusCode::SUCCESS;
370 std::string unresolvedFileName(filename);
373 if (fullFileName ==
"") {
375 std::cerr <<
"RegSelectorMap: FATAL: Could not find input file in DATAPATH" << unresolvedFileName<< std::endl;
376 return StatusCode::FAILURE;
388 sc = StatusCode::FAILURE;
394 std::list<RegSelectorMapElement>::iterator it;
396 for(it = dataList.begin(); it != dataList.end(); ++it){
397 std::cout <<
"position: " << (*it).layerDiskPosition() <<
" number: " << (*it).layerDiskNumber() << std::endl;
400 std::cout <<
"hashId: ";
401 std::vector<IdentifierHash>
aux = (*it).hashId();
402 for(std::vector<IdentifierHash>::iterator i =
aux.begin(); i !=
aux.end(); ++i)
403 std::cout << (*i) <<
" ";
404 std::cout << std::endl;
412 double &phiminIn,
double &phimaxIn )
const {
414 while (phiminIn > 2*
M_PI) phiminIn -= 2*
M_PI;
415 while (phiminIn < 0 ) phiminIn += 2*
M_PI;
416 while (phimaxIn > 2*
M_PI) phimaxIn -= 2*
M_PI;
417 while (phimaxIn < 0 ) phimaxIn += 2*
M_PI;
435 double &phiminIn,
double &phimaxIn )
const {
437 return StatusCode::SUCCESS;
443 double &phiminIn,
double &phimaxIn)
const {
445 StatusCode
sc = StatusCode::SUCCESS;
447 while (phiminIn >
M_PI) phiminIn -= 2*
M_PI;
448 while (phiminIn < -
M_PI) phiminIn += 2*
M_PI;
449 while (phimaxIn >
M_PI) phimaxIn -= 2*
M_PI;
450 while (phimaxIn < -
M_PI) phimaxIn += 2*
M_PI;
469 double phiminIn,
double phimaxIn,
470 const std::vector<IdentifierHash>& outputIdlist)
const {
472 std::vector<IdentifierHash> outset;
475 double etamin, etamax, phimin, phimax;
477 for( i= 0; i < vecsize; ++i){
487 if( (etaminIn <= etamax) && (etamaxIn >= etamin) ){
488 if( (phiminIn <= phimax) && (phimaxIn >= phimin) ){
494 if( (etaminIn <= etamax) && (etamaxIn >= etamin) ){
495 if( (phiminIn <= phimax) && (phimaxIn >= phimin) ){
502 if( (etaminIn <= etamax) && (etamaxIn >= etamin) ){
503 if( (phiminIn <= phimax) && (phimaxIn >= phimin) ){
509 if(outset == outputIdlist)
510 std::cout <<
"equal vectors " << std::endl;
511 std::cout <<
"desired output ";
512 for( j=0; j < outset.size(); ++j)
513 std::cout << std::dec << outset[j] <<
" ";
514 std::cout << std::endl;
515 std::cout <<
"obtained output ";
516 for( j=0; j < outputIdlist.size(); ++j)
517 std::cout << std::dec << outputIdlist[j] <<
" ";
518 std::cout << std::endl;
523 double phiminIn,
double phimaxIn,
524 std::vector<uint32_t>& outList)
const {
528 std::set<uint32_t> outset;
531 double etamin, etamax, phimin, phimax;
532 std::vector<uint32_t> outvec;
535 for( i= 0; i < vecsize; ++i){
545 if( (etaminIn <= etamax) && (etamaxIn >= etamin) ){
546 if( (phiminIn <= phimax) && (phimaxIn >= phimin) ){
552 if( (etaminIn <= etamax) && (etamaxIn >= etamin) ){
553 if( (phiminIn <= phimax) && (phimaxIn >= phimin) ){
560 if( (etaminIn <= etamax) && (etamaxIn >= etamin) ){
561 if( (phiminIn <= phimax) && (phimaxIn >= phimin) ){
568 std::set<uint32_t>::iterator it;
569 for(it = outset.begin(); it != outset.end(); ++it)
570 outvec.push_back(*it);
572 if(outvec == outList)
573 std::cout <<
"equal vectors " << std::endl;
574 std::cout <<
"desired output ";
575 for( j=0; j < outvec.size(); ++j)
576 std::cout << std::dec << outvec[j] <<
" ";
577 std::cout << std::endl;
578 std::cout <<
"obtained output ";
579 for( j=0; j < outList.size(); ++j)
580 std::cout << std::dec << outList[j] <<
" ";
581 std::cout << std::endl;
588 double etaminIn,
double etamaxIn,
589 double phiminIn,
double phimaxIn,
590 std::vector<uint32_t>& outList)
const {
594 std::set<uint32_t> outset;
595 std::list<RegSelectorMapElement>::const_iterator it, itEnd;
596 std::set<uint32_t>::const_iterator itset;
600 if( etaminIn > 0 && etamaxIn > 0 ){
603 (*it).selectionRobIdUint( etaminIn, etamaxIn, phiminIn, phimaxIn, outset);
605 else if( etaminIn < 0 && etamaxIn < 0 ){
608 (*it).selectionRobIdUint( etaminIn, etamaxIn, phiminIn, phimaxIn, outset);
616 if( (*it).layerDiskNumber() == layNumber ) {
617 (*it).selectionRobIdUint( etaminIn, etamaxIn, phiminIn, phimaxIn, outset);
623 for(itset = outset.begin(); itset != outset.end(); ++itset){
624 outList.push_back(*itset);
630 std::list<RegSelectorMapElement>::const_iterator& it)
const {
632 std::list<RegSelectorMapElement>::const_iterator itPos, itNeg, itEnd;
638 if(posORneg ==
false){
653 if( (*it).layerDiskNumber() == typeinID )
661 std::list<RegSelectorMapElement>::const_iterator& it)
const {
663 std::list<RegSelectorMapElement>::const_iterator itPos, itNeg, itEnd;
668 if(posORneg ==
false){
678 if( (*it).layerDiskNumber() == layNumber )
687 std::list<RegSelectorMapElement>::iterator it;
689 for(it = dataList.begin(); it != dataList.end(); ++it){
703 double& etaminIn,
double& etamaxIn,
704 double& phiminIn,
double& phimaxIn,
711 numberIn, positionIn, robIdIn );
717 int numberIn,
double etaminIn,
double etamaxIn,
718 double phiminIn,
double phimaxIn,
722 std::list<RegSelectorMapElement>::iterator it;
724 for(it = dataList.begin(); it != dataList.end(); ++it){
725 if( positionIn == (*it).layerDiskPosition() ){
727 if( numberIn == (*it).layerDiskNumber() ) {
728 (*it).additem( hashIdIn, etaminIn, etamaxIn,
729 phiminIn, phimaxIn, numberIn, positionIn, robIdIn );
739 if(flag ==
true || dataList.size() == 0){
744 dataList.push_back( std::move(newElement) );
749 double& phiminIn,
double& phimaxIn,
IdentifierHash& hashIdIn, uint32_t& robIdIn){
752 etaminIn, etamaxIn, phiminIn, phimaxIn, hashIdIn, robIdIn);
754 else if(positionIn < 0){
756 etaminIn, etamaxIn, phiminIn, phimaxIn, hashIdIn, robIdIn);
758 else if(positionIn == 0){
760 etaminIn, etamaxIn, phiminIn, phimaxIn, hashIdIn, robIdIn);
765 double emin,
double emax,
766 double pmin,
double pmax){
779 StatusCode
sc = StatusCode::SUCCESS;
781 char *buffer = buffer_;
782 int barORend =0, layORwhe =0;
784 double emin, emax, pmin, pmax;
785 uint32_t robid, collid;
787 std::ifstream fin(filename);
789 sc = StatusCode::FAILURE;
792 fin.getline(buffer,128,
'\n');
793 while (fin.getline(buffer, 128,
'\n')){
794 if (strncmp(buffer,
"#",1)!=0){
795 sscanf(buffer,
"%x %x %x %lf %lf %lf %lf", &robid, &collid, (
unsigned int*)&hashId, &emin, &emax, &pmin, &pmax);
796 writeLine(barORend, layORwhe, hashId, robid, emin, emax, pmin, pmax);
807 double *etaMin,
double *etaMax,
808 double *phiMin,
double *phiMax)
const {
TYPEID
An enum to define Muon chambers names.
DETID
An enum to define subdetector names.
#define TYPE(CODE, TYP, IOTYP)
void IDList_layer(long layer, const IRoiDescriptor &roi, std::vector< T > &idlist, handler_layer< C, T > lister) const
void IDList(const IRoiDescriptor &roi, std::vector< T > &idlist, handler< C, T > lister) const
Describes the API of the Region of Ineterest geometry.
virtual bool isFullscan() const =0
is this a full detector RoI?
virtual double phiPlus() const =0
extreme phi values
virtual double phiMinus() const =0
virtual double etaMinus() const =0
virtual double etaPlus() const =0
This is a "hash" representation of an Identifier.
static std::string find_file(const std::string &logical_file_name, const std::string &search_path)
void additem(const IdentifierHash hashId, const double etaMin, const double etaMax, const double phiMin, const double phiMax, const int layerDiskNumber, const int layerDiskPosition, const uint32_t robId)
std::vector< double > m_etamax
void summaryDataFile(std::list< RegSelectorMapElement > &dataList)
std::vector< double > m_phimax
void findPosition(TYPEID typeinID, bool posORneg, std::list< RegSelectorMapElement >::const_iterator &it) const
std::vector< double > m_phimin
void regionSelector(DETID TYPE, double etaminIn, double etamaxIn, double phiminIn, double phimaxIn, std::vector< IdentifierHash > &outList) const
std::list< RegSelectorMapElement > m_posdataList
const std::vector< double > & phiMinOut(void) const
void insertDataElement(int &positionIn, int &numberIn, double &etaminIn, double &etamaxIn, double &phiminIn, double &phimaxIn, IdentifierHash &hashIdIn, uint32_t &robIdIn)
virtual void ROBIDList_internal(const IRoiDescriptor &roi, std::vector< uint32_t > &roblist) const
Rob identifier methods.
void verifyInputsInternal(double &etaminIn, double &etamaxIn, double &phiminIn, double &phimaxIn) const
double phiminValue(void) const
const std::vector< int > & layORdskOut(void) const
std::vector< uint32_t > m_robId
std::vector< IdentifierHash > m_hashId
double etaminValue(void) const
the rest of the class starts here
void getEtaPhi(IdentifierHash hashId, double *etaMin, double *etaMax, double *phiMin, double *phiMax) const
double phimaxValue(void) const
StatusCode read(const char *filename, DETID type)
void verifyOutput(double etaminIn, double etamaxIn, double phiminIn, double phimaxIn, const std::vector< IdentifierHash > &outputIdlist) const
const std::vector< uint32_t > & robIdOut(void) const
const std::vector< IdentifierHash > & hashIdOut(void) const
void regionSelectorRobIdUint(DETID TYPE, double etaminIn, double etamaxIn, double phiminIn, double phimaxIn, std::vector< uint32_t > &outList) const
const std::vector< int > & barORendOut(void) const
void insertList(std::list< RegSelectorMapElement > &dataList, int positionIn, int numberIn, double etaminIn, double etamaxIn, double phiminIn, double phimaxIn, IdentifierHash hashIdIn, uint32_t &robIdIn)
std::list< RegSelectorMapElement > m_barreldataList
std::vector< int > m_layORdsk
const std::vector< double > & etaMaxOut(void) const
const std::vector< double > & etaMinOut(void) const
const std::vector< double > & phiMaxOut(void) const
void writeLine(int barORend, int layORdsk, IdentifierHash hashId, uint32_t robId, double emin, double emax, double pmin, double pmax)
void findMaxMinValues(std::list< RegSelectorMapElement > &dataList)
virtual void HashIDList_internal(const IRoiDescriptor &roi, std::vector< IdentifierHash > &idlist) const
internal lookup table access for full interface ...
StatusCode verifyInputs(double &etaminIn, double &etamaxIn, double &phiminIn, double &phimaxIn) const
std::list< RegSelectorMapElement > m_negdataList
RegSelectorMapElement creatingElement(int &positionIn, int &numberIn, double &etaminIn, double &etamaxIn, double &phiminIn, double &phimaxIn, IdentifierHash &hashIdIn, uint32_t &robId)
virtual void ROBIDList(const IRoiDescriptor &roi, std::vector< uint32_t > &roblist) const override
Rob identifier methods.
std::vector< int > m_barORend
std::vector< double > m_etamin
StatusCode verifyInputsMinusPi(double &etaminIn, double &etamaxIn, double &phiminIn, double &phimaxIn) const
double etamaxValue(void) const
StatusCode readTILE(const char *filename)
void mountDataStruct(void)
virtual void HashIDList(const IRoiDescriptor &roi, std::vector< IdentifierHash > &idlist) const override
implementation of the IRegSelUT interface - intentionally inlined
void addLut(const RegionSelectorLUT *detLut)
int layerDiskNumber(int hashId) const
int hashId(int value) const
double etaMax(int hashId) const
int layerDiskPosition(int hashId) const
double phiMin(int hashId) const
int robId(int hashId) const
unsigned int maxHash(void) const
double etaMin(int hashId) const
double phiMax(int hashId) const