Changeset 271 in Idarraga


Ignore:
Timestamp:
Mar 8, 2012, 3:29:02 PM (12 years ago)
Author:
idarraga
Message:

check detector id replicated

File:
1 edited

Legend:

Unmodified
Added
Removed
  • allpix/src/ReadGeoDescription.cc

    r226 r271  
    1313#include <TList.h>
    1414#include <TString.h>
     15
     16#include <set>
     17using namespace std;
     18
    1519
    1620// to be used as extern later
     
    6670G4int ReadGeoDescription::UseTheseDetectorsOnly(vector<G4int> useDetectors){
    6771
     72        // Check for replicated sensors
     73        set<G4int> checkIds;
     74
    6875        // first verify if all detectors are in the db
    6976        vector<G4int>::iterator itr = useDetectors.begin();
     
    7683                }
    7784
    78         }
     85                if( checkIds.find(*itr) == checkIds.end()) { // not in the list all good
     86                        checkIds.insert( *itr );
     87                } else {
     88                        G4cout << "[OOPS] detector with Id " << *itr << " duplicated in the macro ! please check your macro." << G4endl;
     89                        G4cout << "       Allpix can't recover ... so long, and thanks for all the fish ;)" << G4endl;
     90                        exit(1);
     91                }
     92
     93        }
     94
     95        exit(1);
    7996
    8097        // now erase what's not needed
     
    348365
    349366                                }
     367       
    350368                                else if(m_currentNodeName == __sensor_Resistivity){
    351369
     
    353371                                        m_detsGeo[m_firstIndx]->SetResistivity(val);
    354372
    355                                 }
    356 
    357 
     373                                }                               
     374                               
     375                               
     376                                else if(m_currentNodeName == __MIP_Tot_S){
     377
     378                                        float val = atoi(tempContent.c_str());
     379                                        m_detsGeo[m_firstIndx]->SetMIPTot(val);
     380
     381                                }
     382                               
     383                                else if(m_currentNodeName == __MIP_Charge_S){
     384
     385                                        float val = atof(tempContent.c_str());
     386                                        m_detsGeo[m_firstIndx]->SetMIPCharge(val);
     387
     388                                }
     389                                                               
     390                                else if(m_currentNodeName == __Counter_Depth_S){
     391
     392                                        float val = atoi(tempContent.c_str());
     393                                        m_detsGeo[m_firstIndx]->SetCounterDepth(val);
     394
     395                                }                               
     396
     397                                else if(m_currentNodeName == __Clock_Unit_S){
     398
     399                                        float val = atof(tempContent.c_str());
     400                                        m_detsGeo[m_firstIndx]->SetClockUnit(val);
     401
     402                                }                                       
     403                               
     404                                else if(m_currentNodeName == __Chip_Noise_S){
     405
     406                                        float val = atof(tempContent.c_str());
     407                                        m_detsGeo[m_firstIndx]->SetChipNoise(val);
     408
     409                                }
     410
     411                                else if(m_currentNodeName == __Chip_Threshold_S){
     412
     413                                        float val = atof(tempContent.c_str());
     414                                        m_detsGeo[m_firstIndx]->SetThreshold(val);
     415
     416                                }
     417                               
     418                                else if(m_currentNodeName == __Cross_Talk_S){
     419
     420                                        float val = atof(tempContent.c_str());
     421                                        m_detsGeo[m_firstIndx]->SetCrossTalk(val);
     422
     423                                }
     424                                                               
     425
     426                                else if(m_currentNodeName == __Saturation_Energy_S){
     427
     428                                        float val = atof(tempContent.c_str());
     429                                        m_detsGeo[m_firstIndx]->SetSaturationEnergy(val);
     430
     431                                }
     432                                                               
     433                               
     434                               
     435                               
     436                               
    358437                        }
     438                       
    359439                        /*
    360440                        if(StringIsRelevant(tempContent))
Note: See TracChangeset for help on using the changeset viewer.