CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch2/src/DataFormats/SiStripDetId/src/SiStripSubStructure.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:     SiStripDetId
00004 // Class  :     SiStripSubStructure
00005 // 
00006 // Implementation:
00007 //     <Notes on implementation>
00008 //
00009 // Original Author:  dkcira
00010 //         Created:  Wed Jan 25 07:19:38 CET 2006
00011 // $Id: SiStripSubStructure.cc,v 1.5 2007/03/16 09:57:09 dkcira Exp $
00012 //
00013 
00014 #include "DataFormats/SiStripDetId/interface/StripSubdetector.h"
00015 #include "DataFormats/SiStripDetId/interface/TIBDetId.h"
00016 #include "DataFormats/SiStripDetId/interface/TIDDetId.h"
00017 #include "DataFormats/SiStripDetId/interface/TOBDetId.h"
00018 #include "DataFormats/SiStripDetId/interface/TECDetId.h"
00019 #include "DataFormats/SiStripDetId/interface/SiStripSubStructure.h"
00020 
00021 using namespace std;
00022 
00023 SiStripSubStructure::SiStripSubStructure(){
00024 }
00025 
00026 SiStripSubStructure::~SiStripSubStructure(){
00027 }
00028 
00029 
00030 void SiStripSubStructure::getTIBDetectors(const std::vector<uint32_t> & inputDetRawIds,
00031                                           std::vector<uint32_t> & tibDetRawIds,
00032                                           uint32_t requested_layer,
00033                                           uint32_t requested_bkw_frw,
00034                                           uint32_t requested_int_ext,
00035                                           uint32_t requested_string) const{
00036  // loop over all input detectors
00037   for(vector<uint32_t>::const_iterator it = inputDetRawIds.begin(); it!=inputDetRawIds.end();it++){
00038     uint32_t therawid = (*it);                  // raw id of single detector
00039     TIBDetId potentialTIB = TIBDetId(therawid); // build TIBDetId, at this point is just DetId, but do not want to cast twice
00040     if( potentialTIB.subdetId() ==  int (StripSubdetector::TIB) ){ // check if subdetector field is a TIB, both tested numbers are int
00041       if( // check if TIB is from the ones requested
00042          (    (potentialTIB.layer()==requested_layer) || requested_layer==0 )  // take everything if default value is 0
00043          && ( ((potentialTIB.string()).at(0)==(requested_bkw_frw)) || requested_bkw_frw==0 )
00044          && ( ((potentialTIB.string()).at(1)==(requested_int_ext)) || requested_int_ext==0 )
00045          && ( ((potentialTIB.string()).at(2)==requested_string) || requested_string==0 )
00046          ){
00047         tibDetRawIds.push_back(therawid);       // add detector to list of selected TIBdets
00048       }
00049     }
00050   }
00051 }
00052 
00053 
00054 void SiStripSubStructure::getTIDDetectors(const std::vector<uint32_t> & inputDetRawIds,
00055                                           std::vector<uint32_t> & tidDetRawIds,
00056                                           uint32_t requested_side,
00057                                           uint32_t requested_wheel,
00058                                           uint32_t requested_ring,
00059                                           uint32_t requested_ster) const{
00060  // loop over all input detectors
00061   for(vector<uint32_t>::const_iterator it = inputDetRawIds.begin(); it!=inputDetRawIds.end();it++){
00062     uint32_t therawid = (*it);                  // raw id of single detector
00063     TIDDetId potentialTID = TIDDetId(therawid); // build TIDDetId, at this point is just DetId, but do not want to cast twice
00064     if( potentialTID.subdetId() ==  int (StripSubdetector::TID) ){ // check if subdetector field is a TID, both tested numbers are int
00065       if( // check if TID is from the ones requested
00066          (    (potentialTID.side()==requested_side) || requested_side==0 )  // take everything if default value is 0
00067          && ( (potentialTID.wheel()==requested_wheel) || requested_wheel==0 )
00068          && ( (potentialTID.ring()==requested_ring) || requested_ring==0 )
00069          && ( (potentialTID.stereo()==requested_ster) || requested_ster==0 )
00070          ){
00071         tidDetRawIds.push_back(therawid);       // add detector to list of selected TIDdets
00072       }
00073     }
00074   }
00075 }
00076 
00077 
00078 void SiStripSubStructure::getTOBDetectors(const std::vector<uint32_t> & inputDetRawIds,
00079                                           std::vector<uint32_t> & tobDetRawIds,
00080                                           uint32_t requested_layer,
00081                                           uint32_t requested_bkw_frw,
00082                                           uint32_t requested_rod) const{
00083  // loop over all input detectors
00084   for(vector<uint32_t>::const_iterator it = inputDetRawIds.begin(); it!=inputDetRawIds.end();it++){
00085     uint32_t therawid = (*it);                  // raw id of single detector
00086     TOBDetId potentialTOB = TOBDetId(therawid); // build TOBDetId, at this point is just DetId, but do not want to cast twice
00087     if( potentialTOB.subdetId() ==  int (StripSubdetector::TOB) ){ // check if subdetector field is a TOB, both tested numbers are int
00088       if( // check if TOB is from the ones requested
00089          (    (potentialTOB.layer()==requested_layer) || requested_layer==0 )  // take everything if default value is 0
00090          && ( ((potentialTOB.rod()).at(0)==(requested_bkw_frw)) || requested_bkw_frw==0 )
00091          && ( ((potentialTOB.rod()).at(1)==requested_rod) || requested_rod==0 )
00092          ){
00093         tobDetRawIds.push_back(therawid);       // add detector to list of selected TOBdets
00094       }
00095     }
00096   }
00097 }
00098 
00099 
00100 void SiStripSubStructure::getTECDetectors(const std::vector<uint32_t> & inputDetRawIds,
00101                                           std::vector<uint32_t> & tecDetRawIds,
00102                                           uint32_t requested_side,
00103                                           uint32_t requested_wheel,
00104                                           uint32_t requested_petal_bkw_frw,
00105                                           uint32_t requested_petal,
00106                                           uint32_t requested_ring,
00107                                           uint32_t requested_ster) const{ 
00108  // loop over all input detectors
00109   for(vector<uint32_t>::const_iterator it = inputDetRawIds.begin(); it!=inputDetRawIds.end();it++){
00110     uint32_t therawid = (*it);                  // raw id of single detector
00111     TECDetId potentialTEC = TECDetId(therawid); // build TECDetId, at this point is just DetId, but do not want to cast twice
00112     if( potentialTEC.subdetId() ==  int (StripSubdetector::TEC) ){ // check if subdetector field is a TEC, both tested numbers are int
00113       if( // check if TEC is from the ones requested
00114          (    (potentialTEC.side()==requested_side) || requested_side==0 )  // take everything if default value is 0
00115          && ( (potentialTEC.wheel()==requested_wheel) || requested_wheel==0 )
00116          && ( ((potentialTEC.petal()).at(0)==(requested_petal_bkw_frw-1)) || requested_petal_bkw_frw==0 )
00117          && ( ((potentialTEC.petal()).at(1)==requested_petal) || requested_petal==0 )
00118          && ( (potentialTEC.ring()==requested_ring) || requested_ring==0 )
00119          && ( (potentialTEC.stereo()==requested_ster) || requested_ster==0 )
00120          ){
00121         tecDetRawIds.push_back(therawid);       // add detector to list of selected TECdets
00122       }
00123     }
00124   }
00125 }
00126 
00127