Go to the documentation of this file.00001 #include "DataFormats/TrackerCommon/interface/ClusterSummary.h"
00002
00003 int ClusterSummary::GetModuleLocation ( int mod ) const {
00004
00005 int placeInModsVector = -1;
00006
00007 int cnt = 0;
00008 int pixelcnt = 0;
00009 for(std::vector<int>::const_iterator it = modules_.begin(); it != modules_.end(); ++it) {
00010
00011
00012
00013
00014
00015
00016
00017
00018 int mod_tmp = *it;
00019 while (mod_tmp > 9 ){
00020 mod_tmp /= 10;
00021 }
00022
00023 if ( mod_tmp < 6 ){
00024
00025 if ( mod == (*it) ) {
00026 placeInModsVector = cnt;
00027 break;
00028 }
00029 else ++cnt;
00030
00031 }
00032 else{
00033
00034 if ( mod == (*it) ) {
00035 placeInModsVector = pixelcnt;
00036 break;
00037 }
00038 else ++pixelcnt;
00039
00040 }
00041
00042
00043 }
00044
00045 if (placeInModsVector == -1){
00046 std::ostringstream err;
00047 err<<"No information for requested module "<<mod<<". Please check in the Provinence Infomation for proper modules.";
00048
00049 throw cms::Exception( "Missing Module", err.str());
00050
00051 }
00052
00053 return placeInModsVector;
00054
00055 }
00056
00057
00058
00059 int ClusterSummary::GetVariableLocation ( std::string var ) const {
00060
00061 int placeInUserVector = -1;
00062
00063 int cnt = 0;
00064 for(std::vector<std::string>::const_iterator it = userContent.begin(); it != userContent.end(); ++it) {
00065
00066 if ( var == (*it) ) {
00067 placeInUserVector = cnt;
00068 break;
00069 }
00070 else ++cnt;
00071
00072 }
00073
00074 if (placeInUserVector == -1){
00075 std::ostringstream err;
00076 err<<"No information for requested var "<<var<<". Please check in the Provinence Infomation for proper variables.";
00077
00078 throw cms::Exception( "Missing Variable", err.str());
00079
00080 }
00081
00082 return placeInUserVector;
00083
00084 }
00085
00086
00087
00088
00089 std::vector<std::string> ClusterSummary::DecodeProvInfo(std::string ProvInfo) const {
00090
00091 std::vector<std::string> v_moduleTypes;
00092
00093 std::string mod = ProvInfo;
00094 std::string::size_type i = 0;
00095 std::string::size_type j = mod.find(',');
00096
00097 if ( j == std::string::npos ){
00098 v_moduleTypes.push_back(mod);
00099 }
00100 else{
00101
00102 while (j != std::string::npos) {
00103 v_moduleTypes.push_back(mod.substr(i, j-i));
00104 i = ++j;
00105 j = mod.find(',', j);
00106 if (j == std::string::npos)
00107 v_moduleTypes.push_back(mod.substr(i, mod.length( )));
00108 }
00109
00110 }
00111
00112 return v_moduleTypes;
00113
00114 }
00115
00116
00117
00118 std::pair<int,int> ClusterSummary::ModuleSelection::IsStripSelected(int DetId){
00119
00120
00121 int isselected = 0;
00122 int enumVal = 99999;
00123
00124 SiStripDetId subdet(DetId);
00125 int subdetid = subdet.subDetector();
00126
00127 std::string::size_type result = geosearch.find("_");
00128
00129 if(result != std::string::npos) {
00130
00131
00132
00133
00134
00135 std::string modStr = geosearch;
00136 size_t pos = modStr.find("_", 0);
00137 std::string Mod = modStr.substr(0, pos);
00138 std::string Layer = modStr.substr(pos+1, modStr.length());
00139
00140 std::stringstream ss(Layer);
00141 int layer_id = 0;
00142
00143 ss >> layer_id;
00144
00145 if (SiStripDetId::TIB == subdetid && Mod == "TIB"){
00146
00147 TIBDetId tib(DetId);
00148 int layer = tib.layer();
00149 if (layer_id == layer){
00150
00151 if (layer_id == 1) enumVal = ClusterSummary::TIB_1;
00152 else if (layer_id == 2) enumVal = ClusterSummary::TIB_2;
00153 else if (layer_id == 3) enumVal = ClusterSummary::TIB_3;
00154 else if (layer_id == 4) enumVal = ClusterSummary::TIB_4;
00155
00156 isselected = 1;
00157 }
00158 }
00159
00160 else if (SiStripDetId::TOB == subdetid && Mod == "TOB"){
00161
00162 TOBDetId tob(DetId);
00163 int layer = tob.layer();
00164 if (layer_id == layer){
00165
00166 if (layer_id == 1) enumVal = ClusterSummary::TOB_1;
00167 else if (layer_id == 2) enumVal = ClusterSummary::TOB_2;
00168 else if (layer_id == 3) enumVal = ClusterSummary::TOB_3;
00169 else if (layer_id == 4) enumVal = ClusterSummary::TOB_4;
00170 else if (layer_id == 5) enumVal = ClusterSummary::TOB_5;
00171 else if (layer_id == 6) enumVal = ClusterSummary::TOB_6;
00172
00173 isselected = 1;
00174 }
00175 }
00176
00177 else if (SiStripDetId::TEC == subdetid && Mod == "TECM"){
00178
00179 TECDetId tec(DetId);
00180 int side = (tec.isZMinusSide())?-1:1;
00181 int layerwheel = tec.wheel();
00182
00183 if (layer_id == layerwheel && side == -1){
00184
00185 if (layer_id == 1) enumVal = ClusterSummary::TECM_1;
00186 else if (layer_id == 2) enumVal = ClusterSummary::TECM_2;
00187 else if (layer_id == 3) enumVal = ClusterSummary::TECM_3;
00188 else if (layer_id == 4) enumVal = ClusterSummary::TECM_4;
00189 else if (layer_id == 5) enumVal = ClusterSummary::TECM_5;
00190 else if (layer_id == 6) enumVal = ClusterSummary::TECM_6;
00191 else if (layer_id == 7) enumVal = ClusterSummary::TECM_7;
00192 else if (layer_id == 8) enumVal = ClusterSummary::TECM_8;
00193 else if (layer_id == 9) enumVal = ClusterSummary::TECM_9;
00194
00195 isselected = 1;
00196 }
00197 }
00198
00199 else if (SiStripDetId::TEC == subdetid && Mod == "TECP"){
00200
00201 TECDetId tec(DetId);
00202 int side = (tec.isZMinusSide())?-1:1;
00203 int layerwheel = tec.wheel();
00204
00205 if (layer_id == layerwheel && side == 1){
00206
00207 if (layer_id == 1) enumVal = ClusterSummary::TECP_1;
00208 else if (layer_id == 2) enumVal = ClusterSummary::TECP_2;
00209 else if (layer_id == 3) enumVal = ClusterSummary::TECP_3;
00210 else if (layer_id == 4) enumVal = ClusterSummary::TECP_4;
00211 else if (layer_id == 5) enumVal = ClusterSummary::TECP_5;
00212 else if (layer_id == 6) enumVal = ClusterSummary::TECP_6;
00213 else if (layer_id == 7) enumVal = ClusterSummary::TECP_7;
00214 else if (layer_id == 8) enumVal = ClusterSummary::TECP_8;
00215 else if (layer_id == 9) enumVal = ClusterSummary::TECP_9;
00216
00217 isselected = 1;
00218 }
00219 }
00220
00221
00222 else if (SiStripDetId::TEC == subdetid && Mod == "TECMR"){
00223
00224 TECDetId tec(DetId);
00225 int side = (tec.isZMinusSide())?-1:1;
00226 int ring = tec.ringNumber();
00227
00228 if (layer_id == ring && side == -1){
00229
00230 if (layer_id == 1) enumVal = ClusterSummary::TECMR_1;
00231 else if (layer_id == 2) enumVal = ClusterSummary::TECMR_2;
00232 else if (layer_id == 3) enumVal = ClusterSummary::TECMR_3;
00233 else if (layer_id == 4) enumVal = ClusterSummary::TECMR_4;
00234 else if (layer_id == 5) enumVal = ClusterSummary::TECMR_5;
00235 else if (layer_id == 6) enumVal = ClusterSummary::TECMR_6;
00236 else if (layer_id == 7) enumVal = ClusterSummary::TECMR_7;
00237
00238 isselected = 1;
00239 }
00240 }
00241
00242
00243 else if (SiStripDetId::TEC == subdetid && Mod == "TECPR"){
00244
00245 TECDetId tec(DetId);
00246 int side = (tec.isZMinusSide())?-1:1;
00247 int ring = tec.ringNumber();
00248 if (layer_id == ring && side == 1){
00249
00250 if (layer_id == 1) enumVal = ClusterSummary::TECPR_1;
00251 else if (layer_id == 2) enumVal = ClusterSummary::TECPR_2;
00252 else if (layer_id == 3) enumVal = ClusterSummary::TECPR_3;
00253 else if (layer_id == 4) enumVal = ClusterSummary::TECPR_4;
00254 else if (layer_id == 5) enumVal = ClusterSummary::TECPR_5;
00255 else if (layer_id == 6) enumVal = ClusterSummary::TECPR_6;
00256 else if (layer_id == 7) enumVal = ClusterSummary::TECPR_7;
00257
00258 isselected = 1;
00259 }
00260 }
00261
00262 else if (SiStripDetId::TID == subdetid && Mod == "TIDM"){
00263
00264 TIDDetId tid(DetId);
00265 int side = (tid.isZMinusSide())?-1:1;
00266 int layerwheel = tid.wheel();
00267
00268 if (layer_id == layerwheel && side == -1){
00269
00270 if (layer_id == 1) enumVal = ClusterSummary::TIDM_1;
00271 else if (layer_id == 2) enumVal = ClusterSummary::TIDM_2;
00272 else if (layer_id == 3) enumVal = ClusterSummary::TIDM_3;
00273
00274 isselected = 1;
00275 }
00276 }
00277
00278 else if (SiStripDetId::TID == subdetid && Mod == "TIDP"){
00279
00280 TIDDetId tid(DetId);
00281 int side = (tid.isZMinusSide())?-1:1;
00282 int layerwheel = tid.wheel();
00283
00284 if (layer_id == layerwheel && side == 1){
00285
00286 if (layer_id == 1) enumVal = ClusterSummary::TIDP_1;
00287 else if (layer_id == 2) enumVal = ClusterSummary::TIDP_2;
00288 else if (layer_id == 3) enumVal = ClusterSummary::TIDP_3;
00289
00290 isselected = 1;
00291 }
00292 }
00293
00294
00295 else if (SiStripDetId::TID == subdetid && Mod == "TIDMR"){
00296 TIDDetId tid(DetId);
00297 int side = (tid.isZMinusSide())?-1:1;
00298 int ring = tid.ringNumber();
00299 if (layer_id == ring && side == -1){
00300
00301 if (layer_id == 1) enumVal = ClusterSummary::TIDMR_1;
00302 else if (layer_id == 2) enumVal = ClusterSummary::TIDMR_2;
00303 else if (layer_id == 3) enumVal = ClusterSummary::TIDMR_3;
00304
00305 isselected = 1;
00306 }
00307 }
00308
00309
00310 else if (SiStripDetId::TID == subdetid && Mod == "TIDPR"){
00311 TIDDetId tid(DetId);
00312 int side = (tid.isZMinusSide())?-1:1;
00313 int ring = tid.ringNumber();
00314
00315 if (layer_id == ring && side == 1){
00316
00317 if (layer_id == 1) enumVal = ClusterSummary::TIDPR_1;
00318 else if (layer_id == 2) enumVal = ClusterSummary::TIDPR_2;
00319 else if (layer_id == 3) enumVal = ClusterSummary::TIDPR_3;
00320
00321 isselected = 1;
00322 }
00323 }
00324 }
00325
00326
00327
00328
00329
00330 else if( SiStripDetId::TEC == subdetid && geosearch.compare("TECM")==0 ) {
00331
00332 TECDetId tec(DetId);
00333 int side = (tec.isZMinusSide())?-1:1;
00334
00335 if (side == -1){
00336 isselected = 1;
00337 enumVal = ClusterSummary::TECM;
00338 }
00339 }
00340
00341 else if( SiStripDetId::TEC == subdetid && geosearch.compare("TECP")==0 ) {
00342
00343 TECDetId tec(DetId);
00344 int side = (tec.isZMinusSide())?-1:1;
00345
00346 if (side == 1){
00347 isselected = 1;
00348 enumVal = ClusterSummary::TECP;
00349 }
00350 }
00351
00352
00353 else if( SiStripDetId::TID == subdetid && geosearch.compare("TIDM")==0 ) {
00354
00355 TIDDetId tid(DetId);
00356 int side = (tid.isZMinusSide())?-1:1;
00357
00358 if (side == -1){
00359 isselected = 1;
00360 enumVal = ClusterSummary::TIDM;
00361 }
00362 }
00363
00364
00365 else if( SiStripDetId::TID == subdetid && geosearch.compare("TIDP")==0 ) {
00366
00367 TIDDetId tid(DetId);
00368 int side = (tid.isZMinusSide())?-1:1;
00369
00370 if (side == 1){
00371 isselected = 1;
00372 enumVal = ClusterSummary::TIDP;
00373 }
00374 }
00375
00376
00377
00378
00379
00380 else if( SiStripDetId::TIB == subdetid && geosearch.compare("TIB")==0 ) {
00381 isselected = 1;
00382 enumVal = ClusterSummary::TIB;
00383 }
00384 else if( SiStripDetId::TID == subdetid && geosearch.compare("TID")==0 ) {
00385 isselected = 1;
00386 enumVal = ClusterSummary::TID;
00387 }
00388 else if( SiStripDetId::TOB == subdetid && geosearch.compare("TOB")==0) {
00389 isselected = 1;
00390 enumVal = ClusterSummary::TOB;
00391 }
00392 else if( SiStripDetId::TEC == subdetid && geosearch.compare("TEC")==0) {
00393 isselected = 1;
00394 enumVal = ClusterSummary::TEC;
00395 }
00396 else if( geosearch.compare("TRACKER")==0) {
00397 isselected = 1;
00398 enumVal = ClusterSummary::TRACKER;
00399 }
00400
00401
00402 return std::make_pair(isselected, enumVal);
00403 }
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418 std::pair<int,int> ClusterSummary::ModuleSelection::IsPixelSelected(int detid){
00419
00420
00421 int isselected = 0;
00422 int enumVal = 99999;
00423
00424 DetId detId = DetId(detid);
00425 unsigned int detType=detId.det();
00426 unsigned int subdetid=detId.subdetId();
00427
00428
00429
00430 if(detType!=1) return std::make_pair(0,99999);
00431
00432
00433
00434
00435
00436
00437 if(subdetid == 1 && geosearch.compare("BPIX")==0 ) {
00438 isselected = 1;
00439 enumVal = ClusterSummary::BPIX;
00440 }
00441 else if(subdetid == 2 && geosearch.compare("FPIX")==0 ) {
00442 isselected = 1;
00443 enumVal = ClusterSummary::FPIX;
00444 }
00445 else if( geosearch.compare("PIXEL")==0) {
00446 isselected = 1;
00447 enumVal = ClusterSummary::PIXEL;
00448 }
00449
00450
00451
00452
00453
00454 else if( subdetid == 2 && geosearch.compare("FPIXM")==0 ) {
00455
00456 PXFDetId pdetId = PXFDetId(detid);
00457 int side=pdetId.side();
00458
00459 if (side == 1){
00460 isselected = 1;
00461 enumVal = ClusterSummary::FPIXM;
00462 }
00463 }
00464
00465 else if( subdetid == 2 && geosearch.compare("FPIXP")==0 ) {
00466
00467 PXFDetId pdetId = PXFDetId(detid);
00468 int side=pdetId.side();
00469
00470 if (side == 2){
00471 isselected = 1;
00472 enumVal = ClusterSummary::FPIXP;
00473 }
00474 }
00475
00476
00477
00478 return std::make_pair(isselected, enumVal);
00479 }