30 printalot = (nEventsAnalyzed < int(printout_NEvents));
33 if(0==fmod(
double (nEventsAnalyzed) ,
double(1000) )){
35 printf(
"\n==enter==CSCEfficiency===== run %u\tevent %llu\tn Analyzed %i\n",iRun,iEvent,nEventsAnalyzed);
38 theService->update(eventSetup);
41 if (printalot) printf(
"\tget handles for digi collections\n");
46 if (printalot) printf(
"\tpass handles\n");
58 event.getByToken( wd_token, wires );
59 event.getByToken( sd_token, strips );
60 event.getByToken( al_token, alcts );
61 event.getByToken( cl_token, clcts );
62 event.getByToken( co_token, correlatedlcts );
65 event.getByToken( sh_token, simhits );
67 event.getByToken( rh_token, rechits );
68 event.getByToken( se_token, segments );
69 event.getByToken( tk_token, trackCollectionH );
73 if (printalot) printf(
"\tget the CSC geometry.\n");
81 bool triggerPassed =
true;
87 event.getByToken( ht_token, hltR );
89 triggerPassed = applyTrigger(hltR, triggerNames);
96 if(theService->magneticField()->inTesla(gpZero).mag2()<0.1){
104 fillDigiInfo(alcts, clcts, correlatedlcts, wires, strips, simhits, rechits, segments, cscGeom);
108 event.getByLabel(muonTag_,muons);
111 event.getByLabel(
"offlineBeamSpot", beamSpotHandle);
114 std::vector <reco::MuonCollection::const_iterator> goodMuons_it;
115 unsigned int nPositiveZ = 0;
116 unsigned int nNegativeZ = 0;
117 float muonOuterZPosition = -99999.;
119 if (printalot)
std::cout<<
" muons.size() = "<<muons->size() <<std::endl;
120 for ( reco::MuonCollection::const_iterator
muon = muons->begin();
muon != muons->end(); ++
muon ) {
124 " eta = "<<
muon->eta()<<
" phi = "<<
muon->phi()<<
127 muon->isGlobalMuon()<<
"/"<<
muon->isTrackerMuon()<<
"/"<<
muon->isStandAloneMuon()<<std::endl;
129 if(!(
muon->isTrackerMuon() &&
muon->isGlobalMuon())){
133 double relISO = (
muon->isolationR03().sumPt +
134 muon->isolationR03().emEt +
135 muon->isolationR03().hadEt)/
muon->track()->pt();
137 std::cout<<
" relISO = "<<relISO<<
" emVetoEt = "<<
muon->isolationR03().emVetoEt<<
" caloComp = "<<
146 if(
muon->track()->hitPattern().numberOfValidPixelHits()<1 ||
147 muon->track()->hitPattern().numberOfValidTrackerHits()<11 ||
148 muon->combinedMuon()->hitPattern().numberOfValidMuonHits()<1 ||
149 muon->combinedMuon()->normalizedChi2()>10. ||
150 muon->numberOfMatches()<2){
154 float zOuter =
muon->combinedMuon()->outerPosition().z();
155 float rhoOuter =
muon->combinedMuon()->outerPosition().rho();
156 bool passDepth =
true;
159 if ( fabs(zOuter) < 660. && rhoOuter > 400. && rhoOuter < 540.){
164 else if( fabs(zOuter) > 550. && fabs(zOuter) < 650. && rhoOuter < 300.){
169 else if ( fabs(zOuter) > 680. && fabs(zOuter) < 880. && rhoOuter < 540.){
176 goodMuons_it.push_back(
muon);
177 if(
muon->track()->momentum().z()>0.){
180 if(
muon->track()->momentum().z()<0.){
189 if (printalot)
std::cout<<
"Start track loop over "<<trackCollection.
size()<<
" tracks"<<std::endl;
196 std::cout<<
" nNegativeZ = "<<nNegativeZ<<
" nPositiveZ = "<<nPositiveZ<<std::endl;
198 if(nNegativeZ>1 || nPositiveZ>1){
201 bool trackOK =
false;
203 std::cout<<
" goodMuons_it.size() = "<<goodMuons_it.size()<<std::endl;
205 for(
size_t iM=0;iM<goodMuons_it.size();++iM){
209 float deltaR =
pow(track->
phi()-goodMuons_it[iM]->track()->phi(),2) +
210 pow(track->
eta()-goodMuons_it[iM]->track()->eta(),2);
211 deltaR =
sqrt(deltaR);
213 std::cout<<
" TR mu match to a tr: deltaR = "<<deltaR<<
" dPt = "<<
214 track->
pt()-goodMuons_it[iM]->track()->pt()<<std::endl;
216 if(deltaR>0.01 || fabs(track->
pt()-goodMuons_it[iM]->track()->pt())>0.1 ){
224 muonOuterZPosition = goodMuons_it[iM]->combinedMuon()->outerPosition().z();
231 std::cout<<
" failed: trackOK "<<std::endl;
238 if(trackCollection.
size()>2){
242 if(!
i && 2==trackCollection.
size()){
252 std::cout<<
"i track = "<<
i<<
" P = "<<track->
p()<<
" chi2/ndf = "<<track->
normalizedChi2()<<
" nSeg = "<<segments->size()<<std::endl;
253 std::cout<<
"quality undef/loose/tight/high/confirmed/goodIt/size "<<
289 float dpT_ov_pT = 0.;
290 if(fabs(track->
pt())>0.001){
291 dpT_ov_pT = track->
ptError()/ track->
pt();
298 if(track->
found()<minTrackHits){
302 if(!segments->size()){
306 if(magField && (track->
p()<
minP || track->
p()>maxP)){
310 if(magField && (dpT_ov_pT >0.5) ){
316 if (printalot)
std::cout<<
"good Track"<<std::endl;
319 chooseDirection(r3T_inner, r3T);
322 CLHEP::Hep3Vector p3_propagated, r3_propagated;
325 cov_propagated *= 1
e-20;
326 int charge = track->
charge();
327 FreeTrajectoryState ftsStart = getFromCLHEP(p3T, r3T, charge, covT, &*(theService->magneticField()));
330 std::cout<<
" dump the very first FTS = "<<debug.
dumpFTS(ftsStart)<<std::endl;
343 std::vector< CSCDetId > refME;
344 for(
int iS=1;iS<5;++iS){
345 for(
int iR=1;iR<4;++iR){
349 else if(4==iS && iR>1){
352 refME.push_back(
CSCDetId(endcap, iS, iR, chamber));
356 for(
size_t iSt = 0; iSt<refME.size();++iSt){
358 std::cout<<
"loop iStatation = "<<iSt<<std::endl;
359 std::cout<<
"refME[iSt]: st = "<<refME[iSt].station()<<
" rg = "<<refME[iSt].ring()<<std::endl;
361 std::map <std::string, bool> chamberTypes;
362 chamberTypes[
"ME11"] =
false;
363 chamberTypes[
"ME12"] =
false;
364 chamberTypes[
"ME13"] =
false;
365 chamberTypes[
"ME21"] =
false;
366 chamberTypes[
"ME22"] =
false;
367 chamberTypes[
"ME31"] =
false;
368 chamberTypes[
"ME32"] =
false;
369 chamberTypes[
"ME41"] =
false;
370 const CSCChamber* cscChamber_base = cscGeom->chamber(refME[iSt].chamberId());
373 std::cout<<
" base iStation : eta = "<<cscGeom->idToDet(detId)->surface().position().eta()<<
" phi = "<<
374 cscGeom->idToDet(detId)->surface().position().phi() <<
" y = " <<cscGeom->idToDet(detId)->surface().position().y()<<std::endl;
379 tSOSDest = propagate(ftsStart, cscGeom->idToDet(detId)->surface());
382 if (printalot)
std::cout<<
" dump FTS end = "<<debug.
dumpFTS(ftsStart)<<std::endl;
383 getFromFTS(ftsStart, p3_propagated, r3_propagated, charge, cov_propagated);
384 float feta = fabs(r3_propagated.eta());
385 float phi = r3_propagated.phi();
387 ringCandidates(refME[iSt].
station(), feta, chamberTypes);
389 map<std::string,bool>::iterator
iter;
392 for( iter = chamberTypes.begin(); iter != chamberTypes.end(); iter++ ) {
395 if(iter->second && (iterations-1)==int(iSt)){
397 std::cout<<
" Chamber type "<< iter->first<<
" is a candidate..."<<std::endl;
398 std::cout<<
" station() = "<< refME[iSt].station()<<
" ring() = "<<refME[iSt].ring()<<
" iSt = "<<iSt<<std::endl;
400 std::vector <int> coupleOfChambers;
402 chamberCandidates(refME[iSt].
station(), refME[iSt].
ring(), phi, coupleOfChambers);
404 for(
size_t iCh =0;iCh<coupleOfChambers.size();++iCh){
406 if (printalot)
std::cout<<
" Check chamber N = "<<coupleOfChambers.at(iCh)<<std::endl;;
407 if((!getAbsoluteEfficiency) && (
true == emptyChambers
410 [refME[iSt].
ring()-1]
411 [coupleOfChambers.at(iCh)-
FirstCh])){
415 const CSCChamber* cscChamber = cscGeom->chamber(theCSCId.chamberId());
416 const BoundPlane bpCh = cscGeom->idToDet(cscChamber->geographicalId())->surface();
418 float dz = fabs(bpCh.position().z() - zFTS);
419 float zDistInner = track->
innerPosition().z() - bpCh.position().z();
420 float zDistOuter = track->
outerPosition().z() - bpCh.position().z();
425 if(!isIPdata && (zDistInner*zDistOuter>0. || fabs(zDistInner)<15. || fabs(zDistOuter)<15.)){
427 std::cout<<
" Not an intermediate (as defined) point... Skip."<<std::endl;
431 if(isIPdata && fabs(track->
eta())<1.8){
432 if(fabs(muonOuterZPosition) - fabs(bpCh.position().z())<0 ||
433 fabs(muonOuterZPosition-bpCh.position().z())<15.){
441 tSOSDest = propagate(ftsStart, cscGeom->idToDet(cscChamber->geographicalId())->surface());
446 if(printalot)
std::cout<<
"TSOS not valid! Break."<<std::endl;
451 if(printalot)
std::cout<<
" info: dz<0.1"<<std::endl;
455 bool inDeadZone =
false;
457 for(
int iLayer = 0;iLayer<6;++iLayer){
458 bool extrapolationPassed =
true;
460 std::cout<<
" iLayer = "<<iLayer<<
" dump FTS init = "<<debug.
dumpFTS(ftsInit)<<std::endl;
462 std::cout<<
"Surface to propagate to: pos = "<<cscChamber->layer(iLayer+1)->surface().position()<<
" eta = "
463 <<cscChamber->layer(iLayer+1)->surface().position().eta()<<
" phi = "
464 <<cscChamber->layer(iLayer+1)->surface().position().phi()<<std::endl;
467 tSOSDest = propagate(ftsInit, cscChamber->layer(iLayer+1)->surface());
470 if (printalot)
std::cout<<
" Propagation between layers successful: dump FTS end = "<<debug.
dumpFTS(ftsInit)<<std::endl;
471 getFromFTS(ftsInit, p3_propagated, r3_propagated, charge, cov_propagated);
474 if (printalot)
std::cout<<
"Propagation between layers not successful - notValid TSOS"<<std::endl;
475 extrapolationPassed =
false;
480 if(extrapolationPassed){
481 GlobalPoint theExtrapolationPoint(r3_propagated.x(),r3_propagated.y(),r3_propagated.z());
482 LocalPoint theLocalPoint = cscChamber->layer(iLayer+1)->toLocal(theExtrapolationPoint);
484 inDeadZone = ( inDeadZone ||
485 !inSensitiveLocalRegion(theLocalPoint.x(), theLocalPoint.y(),
486 refME[iSt].station(), refME[iSt].ring()));
488 std::cout<<
" Candidate chamber: extrapolated LocalPoint = "<<theLocalPoint<<
"inDeadZone = "<<inDeadZone<<std::endl;
503 if (printalot)
std::cout<<
"Do efficiencies..."<<std::endl;
506 bool angle_flag =
true; angle_flag = efficienciesPerChamber(theCSCId, cscChamber, ftsStart);
507 if(useDigis && angle_flag){
508 stripWire_Efficiencies(theCSCId, ftsStart);
511 recHitSegment_Efficiencies(theCSCId, cscChamber, ftsStart);
513 recSimHitEfficiency(theCSCId, ftsStart);
518 if(printalot)
std::cout<<
" Not in active area for all layers"<<std::endl;
528 if (printalot)
std::cout<<
" TSOS not valid..."<<std::endl;
533 if (printalot) printf(
"==exit===CSCEfficiency===== run %u\tevent %llu\n\n",iRun,iEvent);
541 std::vector <double> chamberBounds(3);
542 float y_center = 99999.;
544 if(station>1 && station<5){
546 chamberBounds[0] = 66.46/2;
547 chamberBounds[1] = 127.15/2;
548 chamberBounds[2] = 323.06/2;
553 chamberBounds[0] = 54.00/2;
554 chamberBounds[1] = 125.71/2;
555 chamberBounds[2] = 189.66/2;
559 chamberBounds[0] = 61.40/2;
560 chamberBounds[1] = 125.71/2;
561 chamberBounds[2] = 169.70/2;
565 chamberBounds[0] = 69.01/2;
566 chamberBounds[1] = 125.65/2;
567 chamberBounds[2] = 149.42/2;
574 chamberBounds[0] = 63.40/2;
575 chamberBounds[1] = 92.10/2;
576 chamberBounds[2] = 164.16/2;
580 chamberBounds[0] = 51.00/2;
581 chamberBounds[1] = 83.74/2;
582 chamberBounds[2] = 174.49/2;
586 chamberBounds[0] = 30./2;
587 chamberBounds[1] = 60./2;
588 chamberBounds[2] = 160./2;
592 double yUp = chamberBounds[2] + y_center;
593 double yDown = - chamberBounds[2] + y_center;
594 double xBound1Shifted = chamberBounds[0]-distanceFromDeadZone;
595 double xBound2Shifted = chamberBounds[1]-distanceFromDeadZone;
596 double lineSlope = (yUp - yDown)/(xBound2Shifted-xBound1Shifted);
597 double lineConst = yUp - lineSlope*xBound2Shifted;
598 double yBoundary = lineSlope*
abs(xLocal) + lineConst;
599 pass = checkLocal(yLocal, yBoundary, station, ring);
606 std::vector <float> deadZoneCenter(6);
607 const float deadZoneHalf = 0.32*7/2;
608 float cutZone = deadZoneHalf + distanceFromDeadZone;
610 if(station>1 && station<5){
612 deadZoneCenter[0]= -162.48 ;
613 deadZoneCenter[1] = -81.8744;
614 deadZoneCenter[2] = -21.18165;
615 deadZoneCenter[3] = 39.51105;
616 deadZoneCenter[4] = 100.2939;
617 deadZoneCenter[5] = 160.58;
619 if(yLocal >yBoundary &&
620 ((yLocal> deadZoneCenter[0] + cutZone && yLocal< deadZoneCenter[1] - cutZone) ||
621 (yLocal> deadZoneCenter[1] + cutZone && yLocal< deadZoneCenter[2] - cutZone) ||
622 (yLocal> deadZoneCenter[2] + cutZone && yLocal< deadZoneCenter[3] - cutZone) ||
623 (yLocal> deadZoneCenter[3] + cutZone && yLocal< deadZoneCenter[4] - cutZone) ||
624 (yLocal> deadZoneCenter[4] + cutZone && yLocal< deadZoneCenter[5] - cutZone))){
630 deadZoneCenter[0]= -95.94 ;
631 deadZoneCenter[1] = -27.47;
632 deadZoneCenter[2] = 33.67;
633 deadZoneCenter[3] = 93.72;
636 deadZoneCenter[0]= -85.97 ;
637 deadZoneCenter[1] = -36.21;
638 deadZoneCenter[2] = 23.68;
639 deadZoneCenter[3] = 84.04;
642 deadZoneCenter[0]= -75.82;
643 deadZoneCenter[1] = -26.14;
644 deadZoneCenter[2] = 23.85;
645 deadZoneCenter[3] = 73.91;
647 if(yLocal >yBoundary &&
648 ((yLocal> deadZoneCenter[0] + cutZone && yLocal< deadZoneCenter[1] - cutZone) ||
649 (yLocal> deadZoneCenter[1] + cutZone && yLocal< deadZoneCenter[2] - cutZone) ||
650 (yLocal> deadZoneCenter[2] + cutZone && yLocal< deadZoneCenter[3] - cutZone))){
657 deadZoneCenter[0]= -83.155 ;
658 deadZoneCenter[1] = -22.7401;
659 deadZoneCenter[2] = 27.86665;
660 deadZoneCenter[3] = 81.005;
661 if(yLocal > yBoundary &&
662 ((yLocal> deadZoneCenter[0] + cutZone && yLocal< deadZoneCenter[1] - cutZone) ||
663 (yLocal> deadZoneCenter[1] + cutZone && yLocal< deadZoneCenter[2] - cutZone) ||
664 (yLocal> deadZoneCenter[2] + cutZone && yLocal< deadZoneCenter[3] - cutZone))){
669 deadZoneCenter[0]= -86.285 ;
670 deadZoneCenter[1] = -32.88305;
671 deadZoneCenter[2] = 32.867423;
672 deadZoneCenter[3] = 88.205;
673 if(yLocal > (yBoundary) &&
674 ((yLocal> deadZoneCenter[0] + cutZone && yLocal< deadZoneCenter[1] - cutZone) ||
675 (yLocal> deadZoneCenter[1] + cutZone && yLocal< deadZoneCenter[2] - cutZone) ||
676 (yLocal> deadZoneCenter[2] + cutZone && yLocal< deadZoneCenter[3] - cutZone))){
681 deadZoneCenter[0]= -81.0;
682 deadZoneCenter[1] = 81.0;
683 if(yLocal > (yBoundary) &&
684 ((yLocal> deadZoneCenter[0] + cutZone && yLocal< deadZoneCenter[1] - cutZone) )){
701 for(
int iE=0;iE<2;iE++){
702 for(
int iS=0;iS<4;iS++){
703 for(
int iR=0;iR<4;iR++){
704 for(
int iC=0;iC<
NumCh;iC++){
705 allSegments[iE][iS][iR][iC].clear();
706 allCLCT[iE][iS][iR][iC] = allALCT[iE][iS][iR][iC] = allCorrLCT[iE][iS][iR][iC] =
false;
707 for(
int iL=0;iL<6;iL++){
708 allStrips[iE][iS][iR][iC][iL].clear();
709 allWG[iE][iS][iR][iC][iL].clear();
710 allRechits[iE][iS][iR][iC][iL].clear();
711 allSimhits[iE][iS][iR][iC][iL].clear();
719 fillLCT_info(alcts, clcts, correlatedlcts);
720 fillWG_info(wires, cscGeom);
721 fillStrips_info(strips);
723 fillRechitsSegments_info(rechits, segments, cscGeom);
725 fillSimhit_info(simhits);
740 range.first; digiIt!=range.second;
743 if((*digiIt).isValid()){
744 allALCT[
id.endcap()-1][
id.station()-1][
id.ring()-1][
id.chamber()-
FirstCh] =
true;
748 ALCTPerEvent->Fill(nSize);
754 std::vector<CSCCLCTDigi>::const_iterator digiIt = (*j).second.first;
755 std::vector<CSCCLCTDigi>::const_iterator
last = (*j).second.second;
756 for( ; digiIt !=
last; ++digiIt) {
758 if((*digiIt).isValid()){
759 allCLCT[
id.endcap()-1][
id.station()-1][
id.ring()-1][
id.chamber()-
FirstCh] =
true;
763 CLCTPerEvent->Fill(nSize);
767 std::vector<CSCCorrelatedLCTDigi>::const_iterator digiIt = (*j).second.first;
768 std::vector<CSCCorrelatedLCTDigi>::const_iterator
last = (*j).second.second;
769 for( ; digiIt !=
last; ++digiIt) {
771 if((*digiIt).isValid()){
772 allCorrLCT[
id.endcap()-1][
id.station()-1][
id.ring()-1][
id.chamber()-
FirstCh] =
true;
782 const CSCLayer *layer_p = cscGeom->layer (
id);
785 std::vector<CSCWireDigi>::const_iterator digiItr = (*j).second.first;
786 std::vector<CSCWireDigi>::const_iterator
last = (*j).second.second;
788 for( ; digiItr !=
last; ++digiItr) {
789 std::pair < int, float > WG_pos(digiItr->getWireGroup(), layerGeom->
yOfWireGroup(digiItr->getWireGroup()));
790 std::pair <std::pair < int, float >,
int > LayerSignal(WG_pos, digiItr->getTimeBin());
793 allWG[
id.endcap()-1][
id.station()-1][
id.ring()-1][
id.chamber()-
FirstCh]
794 [
id.layer()-1].push_back(LayerSignal);
808 int largestADCValue = -1;
809 std::vector<CSCStripDigi>::const_iterator digiItr = (*j).second.first;
810 std::vector<CSCStripDigi>::const_iterator
last = (*j).second.second;
811 for( ; digiItr !=
last; ++digiItr) {
812 int maxADC=largestADCValue;
813 int myStrip = digiItr->getStrip();
814 std::vector<int> myADCVals = digiItr->getADCCounts();
815 float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
818 float peakADC = -1000.;
819 for (
unsigned int iCount = 0; iCount < myADCVals.size(); iCount++) {
820 diff = (float)myADCVals[iCount]-thisPedestal;
821 if (diff > threshold) {
822 if (myADCVals[iCount] > largestADCValue) {
823 largestADCValue = myADCVals[iCount];
826 if (diff > threshold && diff > peakADC) {
830 if(largestADCValue>maxADC){
831 maxADC = largestADCValue;
832 std::pair <int, float> LayerSignal (myStrip, peakADC);
836 allStrips[
id.endcap()-1][
id.station()-1][
id.ring()-1][
id.chamber()-1][
id.layer()-1].clear();
837 allStrips[
id.endcap()-1][
id.station()-1][
id.ring()-1][
id.chamber()-1][
id.layer()-1].push_back(LayerSignal);
844 edm::PSimHitContainer::const_iterator dSHsimIter;
845 for (dSHsimIter = simhits->begin(); dSHsimIter != simhits->end(); dSHsimIter++){
848 std::pair <LocalPoint, int> simHitPos((*dSHsimIter).localPosition(), (*dSHsimIter).particleType());
861 printf(
" The size of the rechit collection is %i\n",
int(rechits->size()));
864 recHitsPerEvent->Fill(rechits->size());
867 for (recIt = rechits->begin(); recIt != rechits->end(); recIt++) {
871 const CSCLayer* csclayer = cscGeom->layer(
id);
872 LocalPoint rhitlocal = (*recIt).localPosition();
873 LocalError rerrlocal = (*recIt).localPositionError();
875 printf(
"\t\tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",
id.
endcap(),
id.
station(),
id.
ring(),
id.chamber(),
id.layer());
876 printf(
"\t\tx,y,z: %f, %f, %f\texx,eey,exy: %f, %f, %f\tglobal x,y,z: %f, %f, %f \n",
877 rhitlocal.
x(), rhitlocal.
y(), rhitlocal.
z(), rerrlocal.
xx(), rerrlocal.
yy(), rerrlocal.
xy(),
878 rhitglobal.
x(), rhitglobal.
y(), rhitglobal.
z());
880 std::pair <LocalPoint, bool> recHitPos((*recIt).localPosition(),
false);
881 allRechits[
id.endcap()-1][
id.station()-1][
id.ring()-1][
id.chamber()-
FirstCh][
id.layer()-1].push_back(recHitPos);
884 for(
int iE=0;iE<2;iE++){
885 for(
int iS=0;iS<4;iS++){
886 for(
int iR=0;iR<4;iR++){
887 for(
int iC=0;iC<
NumCh;iC++){
889 for(
int iL=0;iL<6;iL++){
890 if(allRechits[iE][iS][iR][iC][iL].
size()){
895 emptyChambers[iE][iS][iR][iC] =
false;
898 emptyChambers[iE][iS][iR][iC] =
true;
907 printf(
" The size of the segment collection is %i\n",
int(segments->size()));
910 segmentsPerEvent->Fill(segments->size());
913 StHist[
id.endcap()-1][
id.station()-1].segmentChi2_ndf->Fill((*it).chi2()/(*it).degreesOfFreedom());
914 StHist[
id.endcap()-1][
id.station()-1].hitsInSegment->Fill((*it).nRecHits());
916 printf(
"\tendcap/station/ring/chamber: %i %i %i %i\n",
918 std::cout<<
"\tposition(loc) = "<<(*it).localPosition()<<
" error(loc) = "<<(*it).localPositionError()<<std::endl;
919 std::cout<<
"\t chi2/ndf = "<<(*it).chi2()/(*it).degreesOfFreedom()<<
" nhits = "<<(*it).nRecHits() <<std::endl;
922 allSegments[
id.endcap()-1][
id.station()-1][
id.ring()-1][
id.chamber()-
FirstCh].push_back
923 (make_pair((*it).localPosition(), (*it).localDirection()));
928 std::vector<CSCRecHit2D> theseRecHits = (*it).specificRecHits();
929 int nRH = (*it).nRecHits();
931 printf(
"\tGet the recHits for this segment.\t");
932 printf(
" nRH = %i\n",nRH);
936 for ( vector<CSCRecHit2D>::const_iterator iRH = theseRecHits.begin(); iRH != theseRecHits.end(); iRH++) {
940 printf(
"\t%i RH\tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",
946 float xDiff = iRH->localPosition().x() -
948 float yDiff = iRH->localPosition().y() -
950 if(fabs(xDiff)<0.0001 && fabs(yDiff)<0.0001){
951 std::pair <LocalPoint, bool>
955 std::cout<<
" number of the rechit (from zero) in the segment = "<< jRH<<std::endl;
968 if(feta>0.85 && feta<1.18){
969 chamberTypes[
"ME13"] =
true;
971 if(feta>1.18 && feta<1.7){
972 chamberTypes[
"ME12"] =
true;
974 if(feta>1.5 && feta<2.45){
975 chamberTypes[
"ME11"] =
true;
979 if(feta>0.95 && feta<1.6){
980 chamberTypes[
"ME22"] =
true;
983 if(feta>1.55 && feta<2.45){
984 chamberTypes[
"ME21"] =
true;
988 if(feta>1.08 && feta<1.72){
989 chamberTypes[
"ME32"] =
true;
992 if(feta>1.69 && feta<2.45){
993 chamberTypes[
"ME31"] =
true;
997 if(feta>1.78 && feta<2.45){
998 chamberTypes[
"ME41"] =
true;
1007 coupleOfChambers.clear();
1009 float phi_zero = 0.;
1010 float phi_const = 2.*
M_PI/36.;
1011 int last_chamber = 36;
1012 int first_chamber = 1;
1013 if(1 != station && 1==ring){
1018 if (printalot)
std::cout<<
" info: negative phi = "<<phi<<std::endl;
1021 float chamber_float = (phi - phi_zero)/phi_const;
1022 int chamber_int = int(chamber_float);
1023 if (chamber_float -
float(chamber_int) -0.5 <0.){
1024 if(0!=chamber_int ){
1025 coupleOfChambers.push_back(chamber_int);
1028 coupleOfChambers.push_back(last_chamber);
1030 coupleOfChambers.push_back(chamber_int+1);
1034 coupleOfChambers.push_back(chamber_int+1);
1035 if(last_chamber!=chamber_int+1){
1036 coupleOfChambers.push_back(chamber_int+2);
1039 coupleOfChambers.push_back(first_chamber);
1042 if (printalot)
std::cout<<
" phi = "<<phi<<
" phi_zero = "<<phi_zero<<
" phi_const = "<<phi_const<<
1043 " candidate chambers: first ch = "<<coupleOfChambers[0]<<
" second ch = "<<coupleOfChambers[1]<<std::endl;
1048 int ec, st, rg, ch, secondRing;
1049 returnTypes(
id, ec, st, rg, ch, secondRing);
1054 std::cout<<
" local dir = "<<localDir<<std::endl;
1057 float dxdz = localDir.
x()/localDir.
z();
1058 float dydz = localDir.
y()/localDir.
z();
1061 std::cout<<
"st 3 or 4 ... flip dy/dz"<<std::endl;
1070 if(applyIPangleCuts){
1071 if(dydz>local_DY_DZ_Max || dydz<local_DY_DZ_Min || fabs(dxdz)>local_DX_DZ_Max){
1077 bool firstCondition = allSegments[ec][st][rg][ch].size() ?
true :
false;
1078 bool secondCondition =
false;
1081 secondCondition = allSegments[ec][st][secondRing][ch].size() ?
true :
false;
1083 if(firstCondition || secondCondition){
1085 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(1);
1090 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(0);
1096 firstCondition = allALCT[ec][st][rg][ch];
1097 secondCondition =
false;
1099 secondCondition = allALCT[ec][st][secondRing][ch];
1101 if(firstCondition || secondCondition){
1103 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(3);
1106 if(fabs(dxdz)<local_DX_DZ_Max){
1107 StHist[ec][st].EfficientALCT_momTheta->Fill(ftsChamber.
momentum().
theta());
1108 ChHist[ec][st][rg][ch].EfficientALCT_dydz->Fill(dydz);
1113 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(2);
1115 if(fabs(dxdz)<local_DX_DZ_Max){
1116 StHist[ec][st].InefficientALCT_momTheta->Fill(ftsChamber.
momentum().
theta());
1117 ChHist[ec][st][rg][ch].InefficientALCT_dydz->Fill(dydz);
1120 std::cout<<
" missing ALCT (dy/dz = "<<dydz<<
")";
1121 printf(
"\t\tendcap/station/ring/chamber: %i/%i/%i/%i\n",ec+1,st+1,rg+1,ch+1);
1126 firstCondition = allCLCT[ec][st][rg][ch];
1127 secondCondition =
false;
1129 secondCondition = allCLCT[ec][st][secondRing][ch];
1131 if(firstCondition || secondCondition){
1133 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(5);
1135 if(dydz<local_DY_DZ_Max && dydz>local_DY_DZ_Min){
1136 StHist[ec][st].EfficientCLCT_momPhi->Fill(ftsChamber.
momentum().
phi() );
1137 ChHist[ec][st][rg][ch].EfficientCLCT_dxdz->Fill(dxdz);
1142 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(4);
1144 if(dydz<local_DY_DZ_Max && dydz>local_DY_DZ_Min){
1145 StHist[ec][st].InefficientCLCT_momPhi->Fill(ftsChamber.
momentum().
phi());
1146 ChHist[ec][st][rg][ch].InefficientCLCT_dxdz->Fill(dxdz);
1149 std::cout<<
" missing CLCT (dx/dz = "<<dxdz<<
")";
1150 printf(
"\t\tendcap/station/ring/chamber: %i/%i/%i/%i\n",ec+1,st+1,rg+1,ch+1);
1155 firstCondition = allCorrLCT[ec][st][rg][ch];
1156 secondCondition =
false;
1158 secondCondition = allCorrLCT[ec][st][secondRing][ch];
1160 if(firstCondition || secondCondition){
1161 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(7);
1164 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(6);
1173 int ec, st, rg, ch, secondRing;
1174 returnTypes(
id, ec, st, rg, ch, secondRing);
1176 bool firstCondition, secondCondition;
1177 int missingLayers_s = 0;
1178 int missingLayers_wg = 0;
1179 for(
int iLayer=0;iLayer<6;iLayer++){
1182 printf(
"\t%i swEff: \tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",
1184 std::cout<<
" size S = "<<allStrips[
id.endcap()-1][
id.station()-1][
id.ring()-1][
id.chamber()-
FirstCh][iLayer].size()<<
1185 "size W = "<<allWG[
id.endcap()-1][
id.station()-1][
id.ring()-1][
id.chamber()-
FirstCh][iLayer].size()<<std::endl;
1188 firstCondition = allStrips[ec][st][rg][ch][iLayer].size() ?
true :
false;
1190 secondCondition =
false;
1192 secondCondition = allStrips[ec][st][secondRing][ch][iLayer].size() ?
true :
false;
1194 if(firstCondition || secondCondition){
1195 ChHist[ec][st][rg][ch].EfficientStrips->Fill(iLayer+1);
1200 printf(
"\t\tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",
id.
endcap(),
id.
station(),
id.
ring(),
id.chamber(),iLayer+1);
1204 firstCondition = allWG[ec][st][rg][ch][iLayer].size() ?
true :
false;
1205 secondCondition =
false;
1207 secondCondition = allWG[ec][st][secondRing][ch][iLayer].size() ?
true :
false;
1209 if(firstCondition || secondCondition){
1210 ChHist[ec][st][rg][ch].EfficientWireGroups->Fill(iLayer+1);
1215 printf(
"\t\tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",
id.
endcap(),
id.
station(),
id.
ring(),
id.chamber(),iLayer+1);
1220 if(6!=missingLayers_s){
1221 ChHist[ec][st][rg][ch].EfficientStrips->Fill(8);
1223 if(6!=missingLayers_wg){
1224 ChHist[ec][st][rg][ch].EfficientWireGroups->Fill(8);
1226 ChHist[ec][st][rg][ch].EfficientStrips->Fill(9);
1227 ChHist[ec][st][rg][ch].EfficientWireGroups->Fill(9);
1229 ChHist[ec][st][rg][ch].StripWiresCorrelations->Fill(1);
1230 if(missingLayers_s!=missingLayers_wg){
1231 ChHist[ec][st][rg][ch].StripWiresCorrelations->Fill(2);
1232 if(6==missingLayers_wg){
1233 ChHist[ec][st][rg][ch].StripWiresCorrelations->Fill(3);
1234 ChHist[ec][st][rg][ch].NoWires_momTheta->Fill(ftsChamber.
momentum().
theta());
1236 if(6==missingLayers_s){
1237 ChHist[ec][st][rg][ch].StripWiresCorrelations->Fill(4);
1238 ChHist[ec][st][rg][ch].NoStrips_momPhi->Fill(ftsChamber.
momentum().
theta());
1241 else if(6==missingLayers_s){
1242 ChHist[ec][st][rg][ch].StripWiresCorrelations->Fill(5);
1249 int ec, st, rg, ch, secondRing;
1250 returnTypes(
id, ec, st, rg, ch, secondRing);
1251 bool firstCondition, secondCondition;
1252 for(
int iLayer=0; iLayer<6;iLayer++){
1253 firstCondition = allSimhits[ec][st][rg][ch][iLayer].size() ?
true :
false;
1254 secondCondition =
false;
1257 secondCondition = allSimhits[ec][st][secondRing][ch][iLayer].size() ?
true :
false;
1258 if(secondCondition){
1259 thisRing = secondRing;
1262 if(firstCondition || secondCondition){
1264 iSH<allSimhits[ec][st][thisRing][ch][iLayer].size();
1267 fabs(allSimhits[ec][st][thisRing][ch][iLayer][iSH].
second)){
1268 ChHist[ec][st][rg][ch].SimSimhits->Fill(iLayer+1);
1269 if(allRechits[ec][st][thisRing][ch][iLayer].
size()){
1270 ChHist[ec][st][rg][ch].SimRechits->Fill(iLayer+1);
1296 int ec, st, rg, ch, secondRing;
1297 returnTypes(
id, ec, st, rg, ch, secondRing);
1298 bool firstCondition, secondCondition;
1300 std::vector <bool> missingLayers_rh(6);
1301 std::vector <int> usedInSegment(6);
1303 if(printalot)
std::cout<<
"RecHits eff"<<std::endl;
1304 for(
int iLayer=0;iLayer<6;++iLayer){
1305 firstCondition = allRechits[ec][st][rg][ch][iLayer].size() ?
true :
false;
1306 secondCondition =
false;
1309 secondCondition = allRechits[ec][st][secondRing][ch][iLayer].size() ?
true :
false;
1310 if(secondCondition){
1311 thisRing = secondRing;
1314 if(firstCondition || secondCondition){
1315 ChHist[ec][st][rg][ch].EfficientRechits_good->Fill(iLayer+1);
1317 iR<allRechits[ec][st][thisRing][ch][iLayer].size();
1319 if(allRechits[ec][st][thisRing][ch][iLayer][iR].
second){
1320 usedInSegment[iLayer] = 1;
1324 usedInSegment[iLayer] = -1;
1329 missingLayers_rh[iLayer] =
true;
1332 printf(
"\t\tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",
id.
endcap(),
id.
station(),
id.
ring(),
id.chamber(),iLayer+1);
1339 firstCondition = allSegments[ec][st][rg][ch].size() ?
true :
false;
1340 secondCondition =
false;
1344 secondCondition = allSegments[ec][st][secondRing][ch].size() ?
true :
false;
1345 secondSize = allSegments[ec][st][secondRing][ch].size();
1346 if(secondCondition){
1347 thisRing = secondRing;
1350 if(firstCondition || secondCondition){
1351 if (printalot)
std::cout<<
"segments - start ec = "<<ec<<
" st = "<<st<<
" rg = "<<rg<<
" ch = "<<ch<<std::endl;
1352 StHist[ec][st].EfficientSegments_XY->Fill(ftsChamber.
position().
x(),ftsChamber.
position().
y());
1353 if(1==allSegments[ec][st][rg][ch].
size() + secondSize){
1354 globalDir = cscChamber->
toGlobal(allSegments[ec][st][thisRing][ch][0].
second);
1355 globalPos = cscChamber->
toGlobal(allSegments[ec][st][thisRing][ch][0].
first);
1356 StHist[ec][st].EfficientSegments_eta->Fill(fabs(ftsChamber.
position().
eta()));
1360 if (printalot)
std::cout<<
" fts.position() = "<<ftsChamber.
position()<<
" segPos = "<<globalPos<<
" res = "<<residual<< std::endl;
1361 StHist[ec][st].ResidualSegments->Fill(residual);
1363 for(
int iLayer=0;iLayer<6;++iLayer){
1364 if(printalot)
std::cout<<
" iLayer = "<<iLayer<<
" usedInSegment = "<<usedInSegment[iLayer]<<std::endl;
1365 if(0!=usedInSegment[iLayer]){
1366 if(-1==usedInSegment[iLayer]){
1367 ChHist[ec][st][rg][ch].InefficientSingleHits->Fill(iLayer+1);
1369 ChHist[ec][st][rg][ch].AllSingleHits->Fill(iLayer+1);
1371 firstCondition = allRechits[ec][st][rg][ch][iLayer].size() ?
true :
false;
1372 secondCondition =
false;
1374 secondCondition = allRechits[ec][st][secondRing][ch][iLayer].size() ?
true :
false;
1376 float stripAngle = 99999.;
1377 std::vector<float> posXY(2);
1378 bool oneSegment =
false;
1379 if(1==allSegments[ec][st][rg][ch].
size() + secondSize){
1382 linearExtrapolation(globalPos,globalDir, bp.position().z(), posXY);
1383 GlobalPoint gp_extrapol( posXY.at(0), posXY.at(1),bp.position().z());
1385 posXY.at(0) = lp_extrapol.
x();
1386 posXY.at(1) = lp_extrapol.y();
1390 if(firstCondition || secondCondition){
1391 ChHist[ec][st][rg][ch].EfficientRechits_inSegment->Fill(iLayer+1);
1393 ChHist[ec][st][rg][ch].Y_EfficientRecHits_inSegment[iLayer]->Fill(posXY.at(1));
1394 ChHist[ec][st][rg][ch].Phi_EfficientRecHits_inSegment[iLayer]->Fill(stripAngle);
1399 ChHist[ec][st][rg][ch].Y_InefficientRecHits_inSegment[iLayer]->Fill(posXY.at(1));
1400 ChHist[ec][st][rg][ch].Phi_InefficientRecHits_inSegment[iLayer]->Fill(stripAngle);
1406 StHist[ec][st].InefficientSegments_XY->Fill(ftsChamber.
position().
x(),ftsChamber.
position().
y());
1408 std::cout<<
"missing segment "<<std::endl;
1409 printf(
"\t\tendcap/station/ring/chamber: %i/%i/%i/%i\n",
id.
endcap(),
id.
station(),
id.
ring(),
id.chamber());
1414 ChHist[ec][st][rg][ch].EfficientRechits_good->Fill(8);
1415 if(allSegments[ec][st][rg][ch].
size()+secondSize<2){
1416 StHist[ec][st].AllSegments_eta->Fill(fabs(ftsChamber.
position().
eta()));
1418 ChHist[ec][st][rg][
id.chamber()-
FirstCh].EfficientRechits_inSegment->Fill(9);
1425 st =
id.station()-1;
1437 CLHEP::Hep3Vector&
p3, CLHEP::Hep3Vector& r3,
1443 p3.set(p3GV.
x(), p3GV.
y(), p3GV.
z());
1444 r3.set(r3GP.
x(), r3GP.
y(), r3GP.
z());
1465 float zSurface, std::vector <float> &posZY){
1466 double paramLine = lineParameter(initialPosition.
z(), zSurface, initialDirection.
z());
1467 double xPosition = extrapolate1D(initialPosition.
x(), initialDirection.
x(),paramLine);
1468 double yPosition = extrapolate1D(initialPosition.
y(), initialDirection.
y(),paramLine);
1470 posZY.push_back(xPosition);
1471 posZY.push_back(yPosition);
1475 double extrapolatedPosition = initPosition + initDirection*parameterOfTheLine;
1476 return extrapolatedPosition;
1480 double paramLine = (destZPosition-initZPosition)/initZDirection;
1488 float dy = outerPosition.y() - innerPosition.y();
1489 float dz = outerPosition.z() - innerPosition.z();
1510 return &*theService->propagator(propagatorName);
1537 propagatorName =
"SteppingHelixPropagatorAny";
1538 tSOSDest = propagator(propagatorName)->propagate(ftsStart, bpDest);
1544 bool triggerPassed =
true;
1545 std::vector<std::string> hlNames=triggerNames.
triggerNames();
1546 pointToTriggers.clear();
1547 for(
size_t imyT = 0;imyT<myTriggers.size();++imyT){
1548 for (
size_t iT=0; iT<hlNames.size(); ++iT) {
1554 if(hltR->wasrun(iT) &&
1557 TriggersFired->Fill(iT);
1560 if(hlNames[iT]==myTriggers[imyT]){
1561 pointToTriggers.push_back(iT);
1568 if(pointToTriggers.size()!=myTriggers.size()){
1569 pointToTriggers.clear();
1571 std::cout<<
" Not all trigger names found - all trigger specifications will be ignored. Check your cfg file!"<<std::endl;
1575 if(pointToTriggers.size()){
1577 std::cout<<
"The following triggers will be required in the event: "<<std::endl;
1578 for(
size_t imyT =0; imyT <pointToTriggers.size();++imyT){
1579 std::cout<<
" "<<hlNames[pointToTriggers[imyT]];
1588 if(!pointToTriggers.size()){
1590 std::cout<<
" No triggers specified in the configuration or all ignored - no trigger information will be considered"<<std::endl;
1593 for(
size_t imyT =0; imyT <pointToTriggers.size();++imyT){
1594 if(hltR->wasrun(pointToTriggers[imyT]) &&
1595 hltR->accept(pointToTriggers[imyT]) &&
1596 !hltR->error(pointToTriggers[imyT]) ){
1597 triggerPassed =
true;
1603 triggerPassed =
false;
1605 triggerPassed =
false;
1613 std::cout<<
" TriggerResults handle returns invalid state?! No trigger information will be considered"<<std::endl;
1617 std::cout<<
" Trigger passed: "<<triggerPassed<<std::endl;
1619 return triggerPassed;
1629 const float Ymin = -165;
1630 const float Ymax = 165;
1631 const int nYbins = int((Ymax - Ymin)/2);
1632 const float Layer_min = -0.5;
1633 const float Layer_max = 9.5;
1634 const int nLayer_bins = int(Layer_max - Layer_min);
1677 myTriggers = pset.
getParameter<std::vector <std::string> >(
"myTriggers");
1679 pointToTriggers.clear();
1683 nEventsAnalyzed = 0;
1690 theFile =
new TFile(rootFileName.c_str(),
"RECREATE");
1695 sprintf(SpecName,
"DataFlow");
1697 new TH1F(SpecName,
"Data flow;condition number;entries",40,-0.5,39.5);
1699 sprintf(SpecName,
"TriggersFired");
1701 new TH1F(SpecName,
"Triggers fired;trigger number;entries",140,-0.5,139.5);
1704 float minChan = -0.5;
1705 float maxChan = 49.5;
1707 sprintf(SpecName,
"ALCTPerEvent");
1708 ALCTPerEvent =
new TH1F(SpecName,
"ALCTs per event;N digis;entries",Chan,minChan,maxChan);
1710 sprintf(SpecName,
"CLCTPerEvent");
1711 CLCTPerEvent =
new TH1F(SpecName,
"CLCTs per event;N digis;entries",Chan,minChan,maxChan);
1713 sprintf(SpecName,
"recHitsPerEvent");
1714 recHitsPerEvent =
new TH1F(SpecName,
"RecHits per event;N digis;entries",150,-0.5,149.5);
1716 sprintf(SpecName,
"segmentsPerEvent");
1717 segmentsPerEvent =
new TH1F(SpecName,
"segments per event;N digis;entries",Chan,minChan,maxChan);
1721 map<std::string,bool>::iterator
iter;
1722 for(
int ec = 0;ec<2;++ec){
1723 for(
int st = 0;st<4;++st){
1725 sprintf(SpecName,
"Stations__E%d_S%d",ec+1, st+1);
1730 sprintf(SpecName,
"segmentChi2_ndf_St%d",st+1);
1731 StHist[ec][st].segmentChi2_ndf =
1732 new TH1F(SpecName,
"Chi2/ndf of a segment;chi2/ndf;entries",100,0.,20.);
1734 sprintf(SpecName,
"hitsInSegment_St%d",st+1);
1735 StHist[ec][st].hitsInSegment =
1736 new TH1F(SpecName,
"Number of hits in a segment;nHits;entries",7,-0.5,6.5);
1742 sprintf(SpecName,
"AllSegments_eta_St%d",st+1);
1743 StHist[ec][st].AllSegments_eta =
1744 new TH1F(SpecName,
"All segments in eta;eta;entries",Chan,minChan,maxChan);
1746 sprintf(SpecName,
"EfficientSegments_eta_St%d",st+1);
1747 StHist[ec][st].EfficientSegments_eta =
1748 new TH1F(SpecName,
"Efficient segments in eta;eta;entries",Chan,minChan,maxChan);
1750 sprintf(SpecName,
"ResidualSegments_St%d",st+1);
1751 StHist[ec][st].ResidualSegments =
1752 new TH1F(SpecName,
"Residual (segments);residual,cm;entries",75,0.,15.);
1758 float minChan2 = -800.;
1759 float maxChan2 = 800.;
1761 sprintf(SpecName,
"EfficientSegments_XY_St%d",st+1);
1762 StHist[ec][st].EfficientSegments_XY =
new TH2F(SpecName,
"Efficient segments in XY;X;Y",
1763 Chan,minChan,maxChan,Chan2,minChan2,maxChan2);
1764 sprintf(SpecName,
"InefficientSegments_XY_St%d",st+1);
1765 StHist[ec][st].InefficientSegments_XY =
new TH2F(SpecName,
"Inefficient segments in XY;X;Y",
1766 Chan,minChan,maxChan,Chan2,minChan2,maxChan2);
1771 sprintf(SpecName,
"EfficientALCT_momTheta_St%d",st+1);
1772 StHist[ec][st].EfficientALCT_momTheta =
new TH1F(SpecName,
"Efficient ALCT in theta (momentum);theta, rad;entries",
1773 Chan,minChan,maxChan);
1775 sprintf(SpecName,
"InefficientALCT_momTheta_St%d",st+1);
1776 StHist[ec][st].InefficientALCT_momTheta =
new TH1F(SpecName,
"Inefficient ALCT in theta (momentum);theta, rad;entries",
1777 Chan,minChan,maxChan);
1782 sprintf(SpecName,
"EfficientCLCT_momPhi_St%d",st+1);
1783 StHist[ec][st].EfficientCLCT_momPhi =
new TH1F(SpecName,
"Efficient CLCT in phi (momentum);phi, rad;entries",
1784 Chan,minChan,maxChan);
1786 sprintf(SpecName,
"InefficientCLCT_momPhi_St%d",st+1);
1787 StHist[ec][st].InefficientCLCT_momPhi =
new TH1F(SpecName,
"Inefficient CLCT in phi (momentum);phi, rad;entries",
1788 Chan,minChan,maxChan);
1791 for(
int rg = 0;rg<3;++rg){
1795 else if(1==rg && 3==st){
1799 if(0!=st && 0==rg && iChamber >18){
1803 sprintf(SpecName,
"Chambers__E%d_S%d_R%d_Chamber_%d",ec+1, st+1, rg+1,iChamber);
1808 sprintf(SpecName,
"EfficientRechits_inSegment_Ch%d",iChamber);
1809 ChHist[ec][st][rg][iChamber-
FirstCh].EfficientRechits_inSegment =
1810 new TH1F(SpecName,
"Existing RecHit given a segment;layers (1-6);entries",nLayer_bins,Layer_min,Layer_max);
1812 sprintf(SpecName,
"InefficientSingleHits_Ch%d",iChamber);
1813 ChHist[ec][st][rg][iChamber-
FirstCh].InefficientSingleHits =
1814 new TH1F(SpecName,
"Single RecHits not in the segment;layers (1-6);entries ",nLayer_bins,Layer_min,Layer_max);
1816 sprintf(SpecName,
"AllSingleHits_Ch%d",iChamber);
1817 ChHist[ec][st][rg][iChamber-
FirstCh].AllSingleHits =
1818 new TH1F(SpecName,
"Single RecHits given a segment; layers (1-6);entries",nLayer_bins,Layer_min,Layer_max);
1820 sprintf(SpecName,
"digiAppearanceCount_Ch%d",iChamber);
1821 ChHist[ec][st][rg][iChamber-
FirstCh].digiAppearanceCount =
1822 new TH1F(SpecName,
"Digi appearance (no-yes): segment(0,1), ALCT(2,3), CLCT(4,5), CorrLCT(6,7); digi type;entries",
1828 sprintf(SpecName,
"EfficientALCT_dydz_Ch%d",iChamber);
1829 ChHist[ec][st][rg][iChamber-
FirstCh].EfficientALCT_dydz =
1830 new TH1F(SpecName,
"Efficient ALCT; local dy/dz (ME 3 and 4 flipped);entries",
1831 Chan, minChan, maxChan);
1833 sprintf(SpecName,
"InefficientALCT_dydz_Ch%d",iChamber);
1834 ChHist[ec][st][rg][iChamber-
FirstCh].InefficientALCT_dydz =
1835 new TH1F(SpecName,
"Inefficient ALCT; local dy/dz (ME 3 and 4 flipped);entries",
1836 Chan, minChan, maxChan);
1841 sprintf(SpecName,
"EfficientCLCT_dxdz_Ch%d",iChamber);
1842 ChHist[ec][st][rg][iChamber-
FirstCh].EfficientCLCT_dxdz =
1843 new TH1F(SpecName,
"Efficient CLCT; local dxdz;entries",
1844 Chan, minChan, maxChan);
1846 sprintf(SpecName,
"InefficientCLCT_dxdz_Ch%d",iChamber);
1847 ChHist[ec][st][rg][iChamber-
FirstCh].InefficientCLCT_dxdz =
1848 new TH1F(SpecName,
"Inefficient CLCT; local dxdz;entries",
1849 Chan, minChan, maxChan);
1851 sprintf(SpecName,
"EfficientRechits_good_Ch%d",iChamber);
1852 ChHist[ec][st][rg][iChamber-
FirstCh].EfficientRechits_good =
1853 new TH1F(SpecName,
"Existing RecHit - sensitive area only;layers (1-6);entries",nLayer_bins,Layer_min,Layer_max);
1855 sprintf(SpecName,
"EfficientStrips_Ch%d",iChamber);
1856 ChHist[ec][st][rg][iChamber-
FirstCh].EfficientStrips =
1857 new TH1F(SpecName,
"Existing strip;layer (1-6); entries",nLayer_bins,Layer_min,Layer_max);
1859 sprintf(SpecName,
"EfficientWireGroups_Ch%d",iChamber);
1860 ChHist[ec][st][rg][iChamber-
FirstCh].EfficientWireGroups =
1861 new TH1F(SpecName,
"Existing WireGroups;layer (1-6); entries ",nLayer_bins,Layer_min,Layer_max);
1863 sprintf(SpecName,
"StripWiresCorrelations_Ch%d",iChamber);
1864 ChHist[ec][st][rg][iChamber-
FirstCh].StripWiresCorrelations =
1865 new TH1F(SpecName,
"StripWire correlations;; entries ",5,0.5,5.5);
1870 sprintf(SpecName,
"NoWires_momTheta_Ch%d",iChamber);
1871 ChHist[ec][st][rg][iChamber-
FirstCh].NoWires_momTheta =
1872 new TH1F(SpecName,
"No wires (all strips present) - in theta (momentum);theta, rad;entries",
1873 Chan,minChan,maxChan);
1878 sprintf(SpecName,
"NoStrips_momPhi_Ch%d",iChamber);
1879 ChHist[ec][st][rg][iChamber-
FirstCh].NoStrips_momPhi =
1880 new TH1F(SpecName,
"No strips (all wires present) - in phi (momentum);phi, rad;entries",
1881 Chan,minChan,maxChan);
1883 for(
int iLayer=0; iLayer<6;iLayer++){
1884 sprintf(SpecName,
"Y_InefficientRecHits_inSegment_Ch%d_L%d",iChamber,iLayer);
1885 ChHist[ec][st][rg][iChamber-
FirstCh].Y_InefficientRecHits_inSegment.push_back
1886 (
new TH1F(SpecName,
"Missing RecHit/layer in a segment (local system, whole chamber);Y, cm; entries",
1887 nYbins,Ymin, Ymax));
1889 sprintf(SpecName,
"Y_EfficientRecHits_inSegment_Ch%d_L%d",iChamber,iLayer);
1890 ChHist[ec][st][rg][iChamber-
FirstCh].Y_EfficientRecHits_inSegment.push_back
1891 (
new TH1F(SpecName,
"Efficient (extrapolated from the segment) RecHit/layer in a segment (local system, whole chamber);Y, cm; entries",
1892 nYbins,Ymin, Ymax));
1897 sprintf(SpecName,
"Phi_InefficientRecHits_inSegment_Ch%d_L%d",iChamber,iLayer);
1898 ChHist[ec][st][rg][iChamber-
FirstCh].Phi_InefficientRecHits_inSegment.push_back
1899 (
new TH1F(SpecName,
"Missing RecHit/layer in a segment (local system, whole chamber);Phi, rad; entries",
1900 Chan, minChan, maxChan));
1902 sprintf(SpecName,
"Phi_EfficientRecHits_inSegment_Ch%d_L%d",iChamber,iLayer);
1903 ChHist[ec][st][rg][iChamber-
FirstCh].Phi_EfficientRecHits_inSegment.push_back
1904 (
new TH1F(SpecName,
"Efficient (extrapolated from the segment) in a segment (local system, whole chamber);Phi, rad; entries",
1905 Chan, minChan, maxChan));
1909 sprintf(SpecName,
"Sim_Rechits_Ch%d",iChamber);
1910 ChHist[ec][st][rg][iChamber-
FirstCh].SimRechits =
1911 new TH1F(SpecName,
"Existing RecHit (Sim);layers (1-6);entries",nLayer_bins,Layer_min,Layer_max);
1913 sprintf(SpecName,
"Sim_Simhits_Ch%d",iChamber);
1914 ChHist[ec][st][rg][iChamber-
FirstCh].SimSimhits =
1915 new TH1F(SpecName,
"Existing SimHit (Sim);layers (1-6);entries",nLayer_bins,Layer_min,Layer_max);
1935 if (theService)
delete theService;
1940 std::vector<float> bins, Efficiency, EffError;
1941 std::vector<float> eff(2);
1944 std::map <std::string, bool> chamberTypes;
1945 chamberTypes[
"ME11"] =
false;
1946 chamberTypes[
"ME12"] =
false;
1947 chamberTypes[
"ME13"] =
false;
1948 chamberTypes[
"ME21"] =
false;
1949 chamberTypes[
"ME22"] =
false;
1950 chamberTypes[
"ME31"] =
false;
1951 chamberTypes[
"ME32"] =
false;
1952 chamberTypes[
"ME41"] =
false;
1954 map<std::string,bool>::iterator
iter;
1955 std::cout<<
" Writing proper histogram structure (patience)..."<<std::endl;
1956 for(
int ec = 0;ec<2;++ec){
1957 for(
int st = 0;st<4;++st){
1958 sprintf(SpecName,
"Stations__E%d_S%d",ec+1, st+1);
1960 StHist[ec][st].segmentChi2_ndf->Write();
1961 StHist[ec][st].hitsInSegment->Write();
1962 StHist[ec][st].AllSegments_eta->Write();
1963 StHist[ec][st].EfficientSegments_eta->Write();
1964 StHist[ec][st].ResidualSegments->Write();
1965 StHist[ec][st].EfficientSegments_XY->Write();
1966 StHist[ec][st].InefficientSegments_XY->Write();
1967 StHist[ec][st].EfficientALCT_momTheta->Write();
1968 StHist[ec][st].InefficientALCT_momTheta->Write();
1969 StHist[ec][st].EfficientCLCT_momPhi->Write();
1970 StHist[ec][st].InefficientCLCT_momPhi->Write();
1971 for(
int rg = 0;rg<3;++rg){
1975 else if(1==rg && 3==st){
1979 if(0!=st && 0==rg && iChamber >18){
1982 sprintf(SpecName,
"Chambers__E%d_S%d_R%d_Chamber_%d",ec+1, st+1, rg+1,iChamber);
1985 ChHist[ec][st][rg][iChamber-
FirstCh].EfficientRechits_inSegment->Write();
1986 ChHist[ec][st][rg][iChamber-
FirstCh].AllSingleHits->Write();
1987 ChHist[ec][st][rg][iChamber-
FirstCh].digiAppearanceCount->Write();
1988 ChHist[ec][st][rg][iChamber-
FirstCh].EfficientALCT_dydz->Write();
1989 ChHist[ec][st][rg][iChamber-
FirstCh].InefficientALCT_dydz->Write();
1990 ChHist[ec][st][rg][iChamber-
FirstCh].EfficientCLCT_dxdz->Write();
1991 ChHist[ec][st][rg][iChamber-
FirstCh].InefficientCLCT_dxdz->Write();
1992 ChHist[ec][st][rg][iChamber-
FirstCh].InefficientSingleHits->Write();
1993 ChHist[ec][st][rg][iChamber-
FirstCh].EfficientRechits_good->Write();
1994 ChHist[ec][st][rg][iChamber-
FirstCh].EfficientStrips->Write();
1995 ChHist[ec][st][rg][iChamber-
FirstCh].StripWiresCorrelations->Write();
1996 ChHist[ec][st][rg][iChamber-
FirstCh].NoWires_momTheta->Write();
1997 ChHist[ec][st][rg][iChamber-
FirstCh].NoStrips_momPhi->Write();
1998 ChHist[ec][st][rg][iChamber-
FirstCh].EfficientWireGroups->Write();
1999 for(
unsigned int iLayer = 0; iLayer< 6; iLayer++){
2000 ChHist[ec][st][rg][iChamber-
FirstCh].Y_InefficientRecHits_inSegment[iLayer]->Write();
2001 ChHist[ec][st][rg][iChamber-
FirstCh].Y_EfficientRecHits_inSegment[iLayer]->Write();
2002 ChHist[ec][st][rg][iChamber-
FirstCh].Phi_InefficientRecHits_inSegment[iLayer]->Write();
2003 ChHist[ec][st][rg][iChamber-
FirstCh].Phi_EfficientRecHits_inSegment[iLayer]->Write();
2005 ChHist[ec][st][rg][iChamber-
FirstCh].SimRechits->Write();
2006 ChHist[ec][st][rg][iChamber-
FirstCh].SimSimhits->Write();
2019 sprintf(SpecName,
"AllChambers");
2023 TriggersFired->Write();
2024 ALCTPerEvent->Write();
2025 CLCTPerEvent->Write();
2026 recHitsPerEvent->Write();
2027 segmentsPerEvent->Write();
double qoverp() const
q / p
double p() const
momentum vector magnitude
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
bool applyTrigger(edm::Handle< edm::TriggerResults > &hltR, const edm::TriggerNames &triggerNames)
CartesianTrajectoryError cartesianError() const
double normalizedChi2() const
chi-squared divided by n.d.o.f. (or chi-squared * 1e6 if n.d.o.f. is zero)
void fillWG_info(edm::Handle< CSCWireDigiCollection > &wires, edm::ESHandle< CSCGeometry > &cscGeom)
void chooseDirection(CLHEP::Hep3Vector &innerPosition, CLHEP::Hep3Vector &outerPosition)
#define DEFINE_FWK_MODULE(type)
void ringCandidates(int station, float absEta, std::map< std::string, bool > &chamberTypes)
double lineParameter(double initZPosition, double destZPosition, double initZDirection)
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepSym< double, 6 > > AlgebraicSymMatrix66
Geom::Phi< T > phi() const
unsigned long long EventNumber_t
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
bool recSimHitEfficiency(CSCDetId &id, FreeTrajectoryState &ftsChamber)
double phi() const
azimuthal angle of momentum vector
CSCEfficiency(const edm::ParameterSet &pset)
Constructor.
TrackCharge charge() const
virtual bool filter(edm::Event &event, const edm::EventSetup &eventSetup)
const math::XYZPoint & outerPosition() const
position of the outermost hit
const Plane & surface() const
The nominal surface of the GeomDet.
Strings const & triggerNames() const
virtual ~CSCEfficiency()
Destructor.
void returnTypes(CSCDetId &id, int &ec, int &st, int &rg, int &ch, int &secondRing)
float yOfWireGroup(int wireGroup, float x=0.) const
float caloCompatibility(const reco::Muon &muon)
FreeTrajectoryState getFromCLHEP(const CLHEP::Hep3Vector &p3, const CLHEP::Hep3Vector &r3, int charge, const AlgebraicSymMatrix66 &cov, const MagneticField *field)
std::string dumpMuonId(const DetId &id) const
Geom::Theta< T > theta() const
std::string dumpFTS(const FreeTrajectoryState &fts) const
const math::XYZPoint & innerPosition() const
position of the innermost hit
U second(std::pair< T, U > const &p)
double eta() const
pseudorapidity of momentum vector
double pt() const
track transverse momentum
FreeTrajectoryState const * freeState(bool withErrors=true) const
double ptError() const
error on Pt (set to 1000 TeV if charge==0 for safety)
unsigned int outerDetId() const
DetId of the detector on which surface the outermost state is located.
Abs< T >::type abs(const T &t)
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to the given id.
DetId geographicalId() const
The label of this GeomDet.
void linearExtrapolation(GlobalPoint initialPosition, GlobalVector initialDirection, float zSurface, std::vector< float > &posZY)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
void getFromFTS(const FreeTrajectoryState &fts, CLHEP::Hep3Vector &p3, CLHEP::Hep3Vector &r3, int &charge, AlgebraicSymMatrix66 &cov)
bool efficienciesPerChamber(CSCDetId &id, const CSCChamber *cscChamber, FreeTrajectoryState &ftsChamber)
GlobalVector momentum() const
void chamberCandidates(int station, int ring, float phi, std::vector< int > &coupleOfChambers)
const AlgebraicSymMatrix66 & matrix() const
void fillLCT_info(edm::Handle< CSCALCTDigiCollection > &alcts, edm::Handle< CSCCLCTDigiCollection > &clcts, edm::Handle< CSCCorrelatedLCTDigiCollection > &correlatedlcts)
void fillRechitsSegments_info(edm::Handle< CSCRecHit2DCollection > &rechits, edm::Handle< CSCSegmentCollection > &segments, edm::ESHandle< CSCGeometry > &cscGeom)
double qoverpError() const
error on signed transverse curvature
bool stripWire_Efficiencies(CSCDetId &cscDetId, FreeTrajectoryState &ftsChamber)
double deltaR(double eta1, double eta2, double phi1, double phi2)
int nearestStrip(const LocalPoint &lp) const
double extrapolate1D(double initPosition, double initDirection, double parameterOfTheLine)
GlobalPoint position() const
void fillDigiInfo(edm::Handle< CSCALCTDigiCollection > &alcts, edm::Handle< CSCCLCTDigiCollection > &clcts, edm::Handle< CSCCorrelatedLCTDigiCollection > &correlatedlcts, edm::Handle< CSCWireDigiCollection > &wires, edm::Handle< CSCStripDigiCollection > &strips, edm::Handle< edm::PSimHitContainer > &simhits, edm::Handle< CSCRecHit2DCollection > &rechits, edm::Handle< CSCSegmentCollection > &segments, edm::ESHandle< CSCGeometry > &cscGeom)
const math::XYZVector & outerMomentum() const
momentum vector at the outermost hit position
T const * product() const
const Propagator * propagator(std::string propagatorName) const
bool recHitSegment_Efficiencies(CSCDetId &cscDetId, const CSCChamber *cscChamber, FreeTrajectoryState &ftsChamber)
std::vector< CSCALCTDigi >::const_iterator const_iterator
bool quality(const TrackQuality) const
Track quality.
bool inSensitiveLocalRegion(double xLocal, double yLocal, int station, int ring)
bool checkLocal(double yLocal, double yBoundary, int station, int ring)
unsigned short found() const
Number of valid hits on track.
void fillSimhit_info(edm::Handle< edm::PSimHitContainer > &simHits)
std::pair< const_iterator, const_iterator > Range
int charge() const
track electric charge
const Point & position() const
position
unsigned int innerDetId() const
DetId of the detector on which surface the innermost state is located.
float stripAngle(int strip) const
const CSCLayerGeometry * geometry() const
tuple size
Write out results.
Power< A, B >::type pow(const A &a, const B &b)
TrajectoryStateOnSurface propagate(FreeTrajectoryState &ftsStart, const BoundPlane &bp)
void fillStrips_info(edm::Handle< CSCStripDigiCollection > &strips)