27 printalot = (nEventsAnalyzed < int(printout_NEvents));
28 int iRun =
event.id().run();
29 int iEvent =
event.id().event();
30 if(0==fmod(
double (nEventsAnalyzed) ,
double(1000) )){
32 printf(
"\n==enter==CSCEfficiency===== run %i\tevent %i\tn Analyzed %i\n",iRun,iEvent,nEventsAnalyzed);
35 theService->update(eventSetup);
38 if (printalot) printf(
"\tget handles for digi collections\n");
43 if (printalot) printf(
"\tpass handles\n");
55 event.getByToken( wd_token, wires );
56 event.getByToken( sd_token, strips );
57 event.getByToken( al_token, alcts );
58 event.getByToken( cl_token, clcts );
59 event.getByToken( co_token, correlatedlcts );
62 event.getByToken( sh_token, simhits );
64 event.getByToken( rh_token, rechits );
65 event.getByToken( se_token, segments );
66 event.getByToken( tk_token, trackCollectionH );
70 if (printalot) printf(
"\tget the CSC geometry.\n");
78 bool triggerPassed =
true;
84 event.getByToken( ht_token, hltR );
86 triggerPassed = applyTrigger(hltR, triggerNames);
93 if(theService->magneticField()->inTesla(gpZero).mag2()<0.1){
101 fillDigiInfo(alcts, clcts, correlatedlcts, wires, strips, simhits, rechits, segments, cscGeom);
105 event.getByLabel(muonTag_,muons);
108 event.getByLabel(
"offlineBeamSpot", beamSpotHandle);
111 std::vector <reco::MuonCollection::const_iterator> goodMuons_it;
112 unsigned int nPositiveZ = 0;
113 unsigned int nNegativeZ = 0;
114 float muonOuterZPosition = -99999.;
116 if (printalot)
std::cout<<
" muons.size() = "<<muons->size() <<std::endl;
117 for ( reco::MuonCollection::const_iterator
muon = muons->begin();
muon != muons->end(); ++
muon ) {
121 " eta = "<<
muon->eta()<<
" phi = "<<
muon->phi()<<
124 muon->isGlobalMuon()<<
"/"<<
muon->isTrackerMuon()<<
"/"<<
muon->isStandAloneMuon()<<std::endl;
126 if(!(
muon->isTrackerMuon() &&
muon->isGlobalMuon())){
130 double relISO = (
muon->isolationR03().sumPt +
131 muon->isolationR03().emEt +
132 muon->isolationR03().hadEt)/
muon->track()->pt();
134 std::cout<<
" relISO = "<<relISO<<
" emVetoEt = "<<
muon->isolationR03().emVetoEt<<
" caloComp = "<<
143 if(
muon->track()->hitPattern().numberOfValidPixelHits()<1 ||
144 muon->track()->hitPattern().numberOfValidTrackerHits()<11 ||
145 muon->combinedMuon()->hitPattern().numberOfValidMuonHits()<1 ||
146 muon->combinedMuon()->normalizedChi2()>10. ||
147 muon->numberOfMatches()<2){
151 float zOuter =
muon->combinedMuon()->outerPosition().z();
152 float rhoOuter =
muon->combinedMuon()->outerPosition().rho();
153 bool passDepth =
true;
156 if ( fabs(zOuter) < 660. && rhoOuter > 400. && rhoOuter < 540.){
161 else if( fabs(zOuter) > 550. && fabs(zOuter) < 650. && rhoOuter < 300.){
166 else if ( fabs(zOuter) > 680. && fabs(zOuter) < 880. && rhoOuter < 540.){
173 goodMuons_it.push_back(
muon);
174 if(
muon->track()->momentum().z()>0.){
177 if(
muon->track()->momentum().z()<0.){
186 if (printalot)
std::cout<<
"Start track loop over "<<trackCollection.
size()<<
" tracks"<<std::endl;
193 std::cout<<
" nNegativeZ = "<<nNegativeZ<<
" nPositiveZ = "<<nPositiveZ<<std::endl;
195 if(nNegativeZ>1 || nPositiveZ>1){
198 bool trackOK =
false;
200 std::cout<<
" goodMuons_it.size() = "<<goodMuons_it.size()<<std::endl;
202 for(
size_t iM=0;iM<goodMuons_it.size();++iM){
206 float deltaR =
pow(track->
phi()-goodMuons_it[iM]->track()->phi(),2) +
207 pow(track->
eta()-goodMuons_it[iM]->track()->eta(),2);
208 deltaR =
sqrt(deltaR);
210 std::cout<<
" TR mu match to a tr: deltaR = "<<deltaR<<
" dPt = "<<
211 track->
pt()-goodMuons_it[iM]->track()->pt()<<std::endl;
213 if(deltaR>0.01 || fabs(track->
pt()-goodMuons_it[iM]->track()->pt())>0.1 ){
221 muonOuterZPosition = goodMuons_it[iM]->combinedMuon()->outerPosition().z();
228 std::cout<<
" failed: trackOK "<<std::endl;
235 if(trackCollection.
size()>2){
239 if(!
i && 2==trackCollection.
size()){
249 std::cout<<
"i track = "<<
i<<
" P = "<<track->
p()<<
" chi2/ndf = "<<track->
normalizedChi2()<<
" nSeg = "<<segments->size()<<std::endl;
250 std::cout<<
"quality undef/loose/tight/high/confirmed/goodIt/size "<<
286 float dpT_ov_pT = 0.;
287 if(fabs(track->
pt())>0.001){
288 dpT_ov_pT = track->
ptError()/ track->
pt();
295 if(track->
found()<minTrackHits){
299 if(!segments->size()){
303 if(magField && (track->
p()<
minP || track->
p()>maxP)){
307 if(magField && (dpT_ov_pT >0.5) ){
313 if (printalot)
std::cout<<
"good Track"<<std::endl;
316 chooseDirection(r3T_inner, r3T);
319 CLHEP::Hep3Vector p3_propagated, r3_propagated;
322 cov_propagated *= 1
e-20;
324 FreeTrajectoryState ftsStart = getFromCLHEP(p3T, r3T, charge, covT, &*(theService->magneticField()));
327 std::cout<<
" dump the very first FTS = "<<debug.
dumpFTS(ftsStart)<<std::endl;
340 std::vector< CSCDetId > refME;
341 for(
int iS=1;iS<5;++iS){
342 for(
int iR=1;iR<4;++iR){
346 else if(4==iS && iR>1){
349 refME.push_back(
CSCDetId(endcap, iS, iR, chamber));
353 for(
size_t iSt = 0; iSt<refME.size();++iSt){
355 std::cout<<
"loop iStatation = "<<iSt<<std::endl;
356 std::cout<<
"refME[iSt]: st = "<<refME[iSt].station()<<
" rg = "<<refME[iSt].ring()<<std::endl;
358 std::map <std::string, bool> chamberTypes;
359 chamberTypes[
"ME11"] =
false;
360 chamberTypes[
"ME12"] =
false;
361 chamberTypes[
"ME13"] =
false;
362 chamberTypes[
"ME21"] =
false;
363 chamberTypes[
"ME22"] =
false;
364 chamberTypes[
"ME31"] =
false;
365 chamberTypes[
"ME32"] =
false;
366 chamberTypes[
"ME41"] =
false;
367 const CSCChamber* cscChamber_base = cscGeom->chamber(refME[iSt].chamberId());
370 std::cout<<
" base iStation : eta = "<<cscGeom->idToDet(detId)->surface().position().eta()<<
" phi = "<<
371 cscGeom->idToDet(detId)->surface().position().phi() <<
" y = " <<cscGeom->idToDet(detId)->surface().position().y()<<std::endl;
376 tSOSDest = propagate(ftsStart, cscGeom->idToDet(detId)->surface());
379 if (printalot)
std::cout<<
" dump FTS end = "<<debug.
dumpFTS(ftsStart)<<std::endl;
380 getFromFTS(ftsStart, p3_propagated, r3_propagated, charge, cov_propagated);
381 float feta = fabs(r3_propagated.eta());
382 float phi = r3_propagated.phi();
384 ringCandidates(refME[iSt].
station(), feta, chamberTypes);
386 map<std::string,bool>::iterator
iter;
389 for( iter = chamberTypes.begin(); iter != chamberTypes.end(); iter++ ) {
392 if(iter->second && (iterations-1)==int(iSt)){
394 std::cout<<
" Chamber type "<< iter->first<<
" is a candidate..."<<std::endl;
395 std::cout<<
" station() = "<< refME[iSt].station()<<
" ring() = "<<refME[iSt].ring()<<
" iSt = "<<iSt<<std::endl;
397 std::vector <int> coupleOfChambers;
399 chamberCandidates(refME[iSt].
station(), refME[iSt].
ring(), phi, coupleOfChambers);
401 for(
size_t iCh =0;iCh<coupleOfChambers.size();++iCh){
403 if (printalot)
std::cout<<
" Check chamber N = "<<coupleOfChambers.at(iCh)<<std::endl;;
404 if((!getAbsoluteEfficiency) && (
true == emptyChambers
407 [refME[iSt].
ring()-1]
408 [coupleOfChambers.at(iCh)-
FirstCh])){
412 const CSCChamber* cscChamber = cscGeom->chamber(theCSCId.chamberId());
413 const BoundPlane bpCh = cscGeom->idToDet(cscChamber->geographicalId())->surface();
415 float dz = fabs(bpCh.position().z() - zFTS);
416 float zDistInner = track->
innerPosition().z() - bpCh.position().z();
417 float zDistOuter = track->
outerPosition().z() - bpCh.position().z();
422 if(!isIPdata && (zDistInner*zDistOuter>0. || fabs(zDistInner)<15. || fabs(zDistOuter)<15.)){
424 std::cout<<
" Not an intermediate (as defined) point... Skip."<<std::endl;
428 if(isIPdata && fabs(track->
eta())<1.8){
429 if(fabs(muonOuterZPosition) - fabs(bpCh.position().z())<0 ||
430 fabs(muonOuterZPosition-bpCh.position().z())<15.){
438 tSOSDest = propagate(ftsStart, cscGeom->idToDet(cscChamber->geographicalId())->surface());
443 if(printalot)
std::cout<<
"TSOS not valid! Break."<<std::endl;
448 if(printalot)
std::cout<<
" info: dz<0.1"<<std::endl;
452 bool inDeadZone =
false;
454 for(
int iLayer = 0;iLayer<6;++iLayer){
455 bool extrapolationPassed =
true;
457 std::cout<<
" iLayer = "<<iLayer<<
" dump FTS init = "<<debug.
dumpFTS(ftsInit)<<std::endl;
459 std::cout<<
"Surface to propagate to: pos = "<<cscChamber->layer(iLayer+1)->surface().position()<<
" eta = "
460 <<cscChamber->layer(iLayer+1)->surface().position().eta()<<
" phi = "
461 <<cscChamber->layer(iLayer+1)->surface().position().phi()<<std::endl;
464 tSOSDest = propagate(ftsInit, cscChamber->layer(iLayer+1)->surface());
467 if (printalot)
std::cout<<
" Propagation between layers successful: dump FTS end = "<<debug.
dumpFTS(ftsInit)<<std::endl;
468 getFromFTS(ftsInit, p3_propagated, r3_propagated, charge, cov_propagated);
471 if (printalot)
std::cout<<
"Propagation between layers not successful - notValid TSOS"<<std::endl;
472 extrapolationPassed =
false;
477 if(extrapolationPassed){
478 GlobalPoint theExtrapolationPoint(r3_propagated.x(),r3_propagated.y(),r3_propagated.z());
479 LocalPoint theLocalPoint = cscChamber->layer(iLayer+1)->toLocal(theExtrapolationPoint);
481 inDeadZone = ( inDeadZone ||
482 !inSensitiveLocalRegion(theLocalPoint.x(), theLocalPoint.y(),
483 refME[iSt].station(), refME[iSt].ring()));
485 std::cout<<
" Candidate chamber: extrapolated LocalPoint = "<<theLocalPoint<<
"inDeadZone = "<<inDeadZone<<std::endl;
500 if (printalot)
std::cout<<
"Do efficiencies..."<<std::endl;
503 bool angle_flag =
true; angle_flag = efficienciesPerChamber(theCSCId, cscChamber, ftsStart);
504 if(useDigis && angle_flag){
505 stripWire_Efficiencies(theCSCId, ftsStart);
508 recHitSegment_Efficiencies(theCSCId, cscChamber, ftsStart);
510 recSimHitEfficiency(theCSCId, ftsStart);
515 if(printalot)
std::cout<<
" Not in active area for all layers"<<std::endl;
525 if (printalot)
std::cout<<
" TSOS not valid..."<<std::endl;
530 if (printalot) printf(
"==exit===CSCEfficiency===== run %i\tevent %i\n\n",iRun,iEvent);
538 std::vector <double> chamberBounds(3);
539 float y_center = 99999.;
541 if(station>1 && station<5){
543 chamberBounds[0] = 66.46/2;
544 chamberBounds[1] = 127.15/2;
545 chamberBounds[2] = 323.06/2;
550 chamberBounds[0] = 54.00/2;
551 chamberBounds[1] = 125.71/2;
552 chamberBounds[2] = 189.66/2;
556 chamberBounds[0] = 61.40/2;
557 chamberBounds[1] = 125.71/2;
558 chamberBounds[2] = 169.70/2;
562 chamberBounds[0] = 69.01/2;
563 chamberBounds[1] = 125.65/2;
564 chamberBounds[2] = 149.42/2;
571 chamberBounds[0] = 63.40/2;
572 chamberBounds[1] = 92.10/2;
573 chamberBounds[2] = 164.16/2;
577 chamberBounds[0] = 51.00/2;
578 chamberBounds[1] = 83.74/2;
579 chamberBounds[2] = 174.49/2;
583 chamberBounds[0] = 30./2;
584 chamberBounds[1] = 60./2;
585 chamberBounds[2] = 160./2;
589 double yUp = chamberBounds[2] + y_center;
590 double yDown = - chamberBounds[2] + y_center;
591 double xBound1Shifted = chamberBounds[0]-distanceFromDeadZone;
592 double xBound2Shifted = chamberBounds[1]-distanceFromDeadZone;
593 double lineSlope = (yUp - yDown)/(xBound2Shifted-xBound1Shifted);
594 double lineConst = yUp - lineSlope*xBound2Shifted;
595 double yBoundary = lineSlope*
abs(xLocal) + lineConst;
596 pass = checkLocal(yLocal, yBoundary, station, ring);
603 std::vector <float> deadZoneCenter(6);
604 const float deadZoneHalf = 0.32*7/2;
605 float cutZone = deadZoneHalf + distanceFromDeadZone;
607 if(station>1 && station<5){
609 deadZoneCenter[0]= -162.48 ;
610 deadZoneCenter[1] = -81.8744;
611 deadZoneCenter[2] = -21.18165;
612 deadZoneCenter[3] = 39.51105;
613 deadZoneCenter[4] = 100.2939;
614 deadZoneCenter[5] = 160.58;
616 if(yLocal >yBoundary &&
617 ((yLocal> deadZoneCenter[0] + cutZone && yLocal< deadZoneCenter[1] - cutZone) ||
618 (yLocal> deadZoneCenter[1] + cutZone && yLocal< deadZoneCenter[2] - cutZone) ||
619 (yLocal> deadZoneCenter[2] + cutZone && yLocal< deadZoneCenter[3] - cutZone) ||
620 (yLocal> deadZoneCenter[3] + cutZone && yLocal< deadZoneCenter[4] - cutZone) ||
621 (yLocal> deadZoneCenter[4] + cutZone && yLocal< deadZoneCenter[5] - cutZone))){
627 deadZoneCenter[0]= -95.94 ;
628 deadZoneCenter[1] = -27.47;
629 deadZoneCenter[2] = 33.67;
630 deadZoneCenter[3] = 93.72;
633 deadZoneCenter[0]= -85.97 ;
634 deadZoneCenter[1] = -36.21;
635 deadZoneCenter[2] = 23.68;
636 deadZoneCenter[3] = 84.04;
639 deadZoneCenter[0]= -75.82;
640 deadZoneCenter[1] = -26.14;
641 deadZoneCenter[2] = 23.85;
642 deadZoneCenter[3] = 73.91;
644 if(yLocal >yBoundary &&
645 ((yLocal> deadZoneCenter[0] + cutZone && yLocal< deadZoneCenter[1] - cutZone) ||
646 (yLocal> deadZoneCenter[1] + cutZone && yLocal< deadZoneCenter[2] - cutZone) ||
647 (yLocal> deadZoneCenter[2] + cutZone && yLocal< deadZoneCenter[3] - cutZone))){
654 deadZoneCenter[0]= -83.155 ;
655 deadZoneCenter[1] = -22.7401;
656 deadZoneCenter[2] = 27.86665;
657 deadZoneCenter[3] = 81.005;
658 if(yLocal > yBoundary &&
659 ((yLocal> deadZoneCenter[0] + cutZone && yLocal< deadZoneCenter[1] - cutZone) ||
660 (yLocal> deadZoneCenter[1] + cutZone && yLocal< deadZoneCenter[2] - cutZone) ||
661 (yLocal> deadZoneCenter[2] + cutZone && yLocal< deadZoneCenter[3] - cutZone))){
666 deadZoneCenter[0]= -86.285 ;
667 deadZoneCenter[1] = -32.88305;
668 deadZoneCenter[2] = 32.867423;
669 deadZoneCenter[3] = 88.205;
670 if(yLocal > (yBoundary) &&
671 ((yLocal> deadZoneCenter[0] + cutZone && yLocal< deadZoneCenter[1] - cutZone) ||
672 (yLocal> deadZoneCenter[1] + cutZone && yLocal< deadZoneCenter[2] - cutZone) ||
673 (yLocal> deadZoneCenter[2] + cutZone && yLocal< deadZoneCenter[3] - cutZone))){
678 deadZoneCenter[0]= -81.0;
679 deadZoneCenter[1] = 81.0;
680 if(yLocal > (yBoundary) &&
681 ((yLocal> deadZoneCenter[0] + cutZone && yLocal< deadZoneCenter[1] - cutZone) )){
698 for(
int iE=0;iE<2;iE++){
699 for(
int iS=0;iS<4;iS++){
700 for(
int iR=0;iR<4;iR++){
701 for(
int iC=0;iC<
NumCh;iC++){
702 allSegments[iE][iS][iR][iC].clear();
703 allCLCT[iE][iS][iR][iC] = allALCT[iE][iS][iR][iC] = allCorrLCT[iE][iS][iR][iC] =
false;
704 for(
int iL=0;iL<6;iL++){
705 allStrips[iE][iS][iR][iC][iL].clear();
706 allWG[iE][iS][iR][iC][iL].clear();
707 allRechits[iE][iS][iR][iC][iL].clear();
708 allSimhits[iE][iS][iR][iC][iL].clear();
716 fillLCT_info(alcts, clcts, correlatedlcts);
717 fillWG_info(wires, cscGeom);
718 fillStrips_info(strips);
720 fillRechitsSegments_info(rechits, segments, cscGeom);
722 fillSimhit_info(simhits);
737 range.first; digiIt!=range.second;
740 if((*digiIt).isValid()){
741 allALCT[
id.endcap()-1][
id.station()-1][
id.ring()-1][
id.chamber()-
FirstCh] =
true;
745 ALCTPerEvent->Fill(nSize);
751 std::vector<CSCCLCTDigi>::const_iterator digiIt = (*j).second.first;
752 std::vector<CSCCLCTDigi>::const_iterator
last = (*j).second.second;
753 for( ; digiIt !=
last; ++digiIt) {
755 if((*digiIt).isValid()){
756 allCLCT[
id.endcap()-1][
id.station()-1][
id.ring()-1][
id.chamber()-
FirstCh] =
true;
760 CLCTPerEvent->Fill(nSize);
764 std::vector<CSCCorrelatedLCTDigi>::const_iterator digiIt = (*j).second.first;
765 std::vector<CSCCorrelatedLCTDigi>::const_iterator
last = (*j).second.second;
766 for( ; digiIt !=
last; ++digiIt) {
768 if((*digiIt).isValid()){
769 allCorrLCT[
id.endcap()-1][
id.station()-1][
id.ring()-1][
id.chamber()-
FirstCh] =
true;
779 const CSCLayer *layer_p = cscGeom->layer (
id);
782 std::vector<CSCWireDigi>::const_iterator digiItr = (*j).second.first;
783 std::vector<CSCWireDigi>::const_iterator
last = (*j).second.second;
785 for( ; digiItr !=
last; ++digiItr) {
786 std::pair < int, float > WG_pos(digiItr->getWireGroup(), layerGeom->
yOfWireGroup(digiItr->getWireGroup()));
787 std::pair <std::pair < int, float >,
int > LayerSignal(WG_pos, digiItr->getTimeBin());
790 allWG[
id.endcap()-1][
id.station()-1][
id.ring()-1][
id.chamber()-
FirstCh]
791 [
id.layer()-1].push_back(LayerSignal);
805 int largestADCValue = -1;
806 std::vector<CSCStripDigi>::const_iterator digiItr = (*j).second.first;
807 std::vector<CSCStripDigi>::const_iterator
last = (*j).second.second;
808 for( ; digiItr !=
last; ++digiItr) {
809 int maxADC=largestADCValue;
810 int myStrip = digiItr->getStrip();
811 std::vector<int> myADCVals = digiItr->getADCCounts();
812 float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
815 float peakADC = -1000.;
816 for (
unsigned int iCount = 0; iCount < myADCVals.size(); iCount++) {
817 diff = (float)myADCVals[iCount]-thisPedestal;
818 if (diff > threshold) {
819 if (myADCVals[iCount] > largestADCValue) {
820 largestADCValue = myADCVals[iCount];
823 if (diff > threshold && diff > peakADC) {
827 if(largestADCValue>maxADC){
828 maxADC = largestADCValue;
829 std::pair <int, float> LayerSignal (myStrip, peakADC);
833 allStrips[
id.endcap()-1][
id.station()-1][
id.ring()-1][
id.chamber()-1][
id.layer()-1].clear();
834 allStrips[
id.endcap()-1][
id.station()-1][
id.ring()-1][
id.chamber()-1][
id.layer()-1].push_back(LayerSignal);
841 edm::PSimHitContainer::const_iterator dSHsimIter;
842 for (dSHsimIter = simhits->begin(); dSHsimIter != simhits->end(); dSHsimIter++){
845 std::pair <LocalPoint, int> simHitPos((*dSHsimIter).localPosition(), (*dSHsimIter).particleType());
858 printf(
" The size of the rechit collection is %i\n",
int(rechits->size()));
861 recHitsPerEvent->Fill(rechits->size());
864 for (recIt = rechits->begin(); recIt != rechits->end(); recIt++) {
868 const CSCLayer* csclayer = cscGeom->layer(
id);
869 LocalPoint rhitlocal = (*recIt).localPosition();
870 LocalError rerrlocal = (*recIt).localPositionError();
872 printf(
"\t\tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",
id.
endcap(),
id.
station(),
id.
ring(),
id.chamber(),
id.layer());
873 printf(
"\t\tx,y,z: %f, %f, %f\texx,eey,exy: %f, %f, %f\tglobal x,y,z: %f, %f, %f \n",
874 rhitlocal.
x(), rhitlocal.
y(), rhitlocal.
z(), rerrlocal.
xx(), rerrlocal.
yy(), rerrlocal.
xy(),
875 rhitglobal.
x(), rhitglobal.
y(), rhitglobal.
z());
877 std::pair <LocalPoint, bool> recHitPos((*recIt).localPosition(),
false);
878 allRechits[
id.endcap()-1][
id.station()-1][
id.ring()-1][
id.chamber()-
FirstCh][
id.layer()-1].push_back(recHitPos);
881 for(
int iE=0;iE<2;iE++){
882 for(
int iS=0;iS<4;iS++){
883 for(
int iR=0;iR<4;iR++){
884 for(
int iC=0;iC<
NumCh;iC++){
886 for(
int iL=0;iL<6;iL++){
887 if(allRechits[iE][iS][iR][iC][iL].
size()){
892 emptyChambers[iE][iS][iR][iC] =
false;
895 emptyChambers[iE][iS][iR][iC] =
true;
904 printf(
" The size of the segment collection is %i\n",
int(segments->size()));
907 segmentsPerEvent->Fill(segments->size());
910 StHist[
id.endcap()-1][
id.station()-1].segmentChi2_ndf->Fill((*it).chi2()/(*it).degreesOfFreedom());
911 StHist[
id.endcap()-1][
id.station()-1].hitsInSegment->Fill((*it).nRecHits());
913 printf(
"\tendcap/station/ring/chamber: %i %i %i %i\n",
915 std::cout<<
"\tposition(loc) = "<<(*it).localPosition()<<
" error(loc) = "<<(*it).localPositionError()<<std::endl;
916 std::cout<<
"\t chi2/ndf = "<<(*it).chi2()/(*it).degreesOfFreedom()<<
" nhits = "<<(*it).nRecHits() <<std::endl;
919 allSegments[
id.endcap()-1][
id.station()-1][
id.ring()-1][
id.chamber()-
FirstCh].push_back
920 (make_pair((*it).localPosition(), (*it).localDirection()));
925 std::vector<CSCRecHit2D> theseRecHits = (*it).specificRecHits();
926 int nRH = (*it).nRecHits();
928 printf(
"\tGet the recHits for this segment.\t");
929 printf(
" nRH = %i\n",nRH);
933 for ( vector<CSCRecHit2D>::const_iterator iRH = theseRecHits.begin(); iRH != theseRecHits.end(); iRH++) {
937 printf(
"\t%i RH\tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",
943 float xDiff = iRH->localPosition().x() -
945 float yDiff = iRH->localPosition().y() -
947 if(fabs(xDiff)<0.0001 && fabs(yDiff)<0.0001){
948 std::pair <LocalPoint, bool>
952 std::cout<<
" number of the rechit (from zero) in the segment = "<< jRH<<std::endl;
965 if(feta>0.85 && feta<1.18){
966 chamberTypes[
"ME13"] =
true;
968 if(feta>1.18 && feta<1.7){
969 chamberTypes[
"ME12"] =
true;
971 if(feta>1.5 && feta<2.45){
972 chamberTypes[
"ME11"] =
true;
976 if(feta>0.95 && feta<1.6){
977 chamberTypes[
"ME22"] =
true;
980 if(feta>1.55 && feta<2.45){
981 chamberTypes[
"ME21"] =
true;
985 if(feta>1.08 && feta<1.72){
986 chamberTypes[
"ME32"] =
true;
989 if(feta>1.69 && feta<2.45){
990 chamberTypes[
"ME31"] =
true;
994 if(feta>1.78 && feta<2.45){
995 chamberTypes[
"ME41"] =
true;
1004 coupleOfChambers.clear();
1006 float phi_zero = 0.;
1007 float phi_const = 2.*
M_PI/36.;
1008 int last_chamber = 36;
1009 int first_chamber = 1;
1010 if(1 != station && 1==ring){
1015 if (printalot)
std::cout<<
" info: negative phi = "<<phi<<std::endl;
1018 float chamber_float = (phi - phi_zero)/phi_const;
1019 int chamber_int = int(chamber_float);
1020 if (chamber_float -
float(chamber_int) -0.5 <0.){
1021 if(0!=chamber_int ){
1022 coupleOfChambers.push_back(chamber_int);
1025 coupleOfChambers.push_back(last_chamber);
1027 coupleOfChambers.push_back(chamber_int+1);
1031 coupleOfChambers.push_back(chamber_int+1);
1032 if(last_chamber!=chamber_int+1){
1033 coupleOfChambers.push_back(chamber_int+2);
1036 coupleOfChambers.push_back(first_chamber);
1039 if (printalot)
std::cout<<
" phi = "<<phi<<
" phi_zero = "<<phi_zero<<
" phi_const = "<<phi_const<<
1040 " candidate chambers: first ch = "<<coupleOfChambers[0]<<
" second ch = "<<coupleOfChambers[1]<<std::endl;
1045 int ec, st, rg, ch, secondRing;
1046 returnTypes(
id, ec, st, rg, ch, secondRing);
1051 std::cout<<
" local dir = "<<localDir<<std::endl;
1054 float dxdz = localDir.
x()/localDir.
z();
1055 float dydz = localDir.
y()/localDir.
z();
1058 std::cout<<
"st 3 or 4 ... flip dy/dz"<<std::endl;
1067 if(applyIPangleCuts){
1068 if(dydz>local_DY_DZ_Max || dydz<local_DY_DZ_Min || fabs(dxdz)>local_DX_DZ_Max){
1074 bool firstCondition = allSegments[ec][st][rg][ch].size() ?
true :
false;
1075 bool secondCondition =
false;
1078 secondCondition = allSegments[ec][st][secondRing][ch].size() ?
true :
false;
1080 if(firstCondition || secondCondition){
1082 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(1);
1087 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(0);
1093 firstCondition = allALCT[ec][st][rg][ch];
1094 secondCondition =
false;
1096 secondCondition = allALCT[ec][st][secondRing][ch];
1098 if(firstCondition || secondCondition){
1100 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(3);
1103 if(fabs(dxdz)<local_DX_DZ_Max){
1104 StHist[ec][st].EfficientALCT_momTheta->Fill(ftsChamber.
momentum().
theta());
1105 ChHist[ec][st][rg][ch].EfficientALCT_dydz->Fill(dydz);
1110 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(2);
1112 if(fabs(dxdz)<local_DX_DZ_Max){
1113 StHist[ec][st].InefficientALCT_momTheta->Fill(ftsChamber.
momentum().
theta());
1114 ChHist[ec][st][rg][ch].InefficientALCT_dydz->Fill(dydz);
1117 std::cout<<
" missing ALCT (dy/dz = "<<dydz<<
")";
1118 printf(
"\t\tendcap/station/ring/chamber: %i/%i/%i/%i\n",ec+1,st+1,rg+1,ch+1);
1123 firstCondition = allCLCT[ec][st][rg][ch];
1124 secondCondition =
false;
1126 secondCondition = allCLCT[ec][st][secondRing][ch];
1128 if(firstCondition || secondCondition){
1130 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(5);
1132 if(dydz<local_DY_DZ_Max && dydz>local_DY_DZ_Min){
1133 StHist[ec][st].EfficientCLCT_momPhi->Fill(ftsChamber.
momentum().
phi() );
1134 ChHist[ec][st][rg][ch].EfficientCLCT_dxdz->Fill(dxdz);
1139 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(4);
1141 if(dydz<local_DY_DZ_Max && dydz>local_DY_DZ_Min){
1142 StHist[ec][st].InefficientCLCT_momPhi->Fill(ftsChamber.
momentum().
phi());
1143 ChHist[ec][st][rg][ch].InefficientCLCT_dxdz->Fill(dxdz);
1146 std::cout<<
" missing CLCT (dx/dz = "<<dxdz<<
")";
1147 printf(
"\t\tendcap/station/ring/chamber: %i/%i/%i/%i\n",ec+1,st+1,rg+1,ch+1);
1152 firstCondition = allCorrLCT[ec][st][rg][ch];
1153 secondCondition =
false;
1155 secondCondition = allCorrLCT[ec][st][secondRing][ch];
1157 if(firstCondition || secondCondition){
1158 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(7);
1161 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(6);
1170 int ec, st, rg, ch, secondRing;
1171 returnTypes(
id, ec, st, rg, ch, secondRing);
1173 bool firstCondition, secondCondition;
1174 int missingLayers_s = 0;
1175 int missingLayers_wg = 0;
1176 for(
int iLayer=0;iLayer<6;iLayer++){
1179 printf(
"\t%i swEff: \tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",
1181 std::cout<<
" size S = "<<allStrips[
id.endcap()-1][
id.station()-1][
id.ring()-1][
id.chamber()-
FirstCh][iLayer].size()<<
1182 "size W = "<<allWG[
id.endcap()-1][
id.station()-1][
id.ring()-1][
id.chamber()-
FirstCh][iLayer].size()<<std::endl;
1185 firstCondition = allStrips[ec][st][rg][ch][iLayer].size() ?
true :
false;
1187 secondCondition =
false;
1189 secondCondition = allStrips[ec][st][secondRing][ch][iLayer].size() ?
true :
false;
1191 if(firstCondition || secondCondition){
1192 ChHist[ec][st][rg][ch].EfficientStrips->Fill(iLayer+1);
1197 printf(
"\t\tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",
id.
endcap(),
id.
station(),
id.
ring(),
id.chamber(),iLayer+1);
1201 firstCondition = allWG[ec][st][rg][ch][iLayer].size() ?
true :
false;
1202 secondCondition =
false;
1204 secondCondition = allWG[ec][st][secondRing][ch][iLayer].size() ?
true :
false;
1206 if(firstCondition || secondCondition){
1207 ChHist[ec][st][rg][ch].EfficientWireGroups->Fill(iLayer+1);
1212 printf(
"\t\tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",
id.
endcap(),
id.
station(),
id.
ring(),
id.chamber(),iLayer+1);
1217 if(6!=missingLayers_s){
1218 ChHist[ec][st][rg][ch].EfficientStrips->Fill(8);
1220 if(6!=missingLayers_wg){
1221 ChHist[ec][st][rg][ch].EfficientWireGroups->Fill(8);
1223 ChHist[ec][st][rg][ch].EfficientStrips->Fill(9);
1224 ChHist[ec][st][rg][ch].EfficientWireGroups->Fill(9);
1226 ChHist[ec][st][rg][ch].StripWiresCorrelations->Fill(1);
1227 if(missingLayers_s!=missingLayers_wg){
1228 ChHist[ec][st][rg][ch].StripWiresCorrelations->Fill(2);
1229 if(6==missingLayers_wg){
1230 ChHist[ec][st][rg][ch].StripWiresCorrelations->Fill(3);
1231 ChHist[ec][st][rg][ch].NoWires_momTheta->Fill(ftsChamber.
momentum().
theta());
1233 if(6==missingLayers_s){
1234 ChHist[ec][st][rg][ch].StripWiresCorrelations->Fill(4);
1235 ChHist[ec][st][rg][ch].NoStrips_momPhi->Fill(ftsChamber.
momentum().
theta());
1238 else if(6==missingLayers_s){
1239 ChHist[ec][st][rg][ch].StripWiresCorrelations->Fill(5);
1246 int ec, st, rg, ch, secondRing;
1247 returnTypes(
id, ec, st, rg, ch, secondRing);
1248 bool firstCondition, secondCondition;
1249 for(
int iLayer=0; iLayer<6;iLayer++){
1250 firstCondition = allSimhits[ec][st][rg][ch][iLayer].size() ?
true :
false;
1251 secondCondition =
false;
1254 secondCondition = allSimhits[ec][st][secondRing][ch][iLayer].size() ?
true :
false;
1255 if(secondCondition){
1256 thisRing = secondRing;
1259 if(firstCondition || secondCondition){
1261 iSH<allSimhits[ec][st][thisRing][ch][iLayer].size();
1264 fabs(allSimhits[ec][st][thisRing][ch][iLayer][iSH].
second)){
1265 ChHist[ec][st][rg][ch].SimSimhits->Fill(iLayer+1);
1266 if(allRechits[ec][st][thisRing][ch][iLayer].
size()){
1267 ChHist[ec][st][rg][ch].SimRechits->Fill(iLayer+1);
1293 int ec, st, rg, ch, secondRing;
1294 returnTypes(
id, ec, st, rg, ch, secondRing);
1295 bool firstCondition, secondCondition;
1297 std::vector <bool> missingLayers_rh(6);
1298 std::vector <int> usedInSegment(6);
1300 if(printalot)
std::cout<<
"RecHits eff"<<std::endl;
1301 for(
int iLayer=0;iLayer<6;++iLayer){
1302 firstCondition = allRechits[ec][st][rg][ch][iLayer].size() ?
true :
false;
1303 secondCondition =
false;
1306 secondCondition = allRechits[ec][st][secondRing][ch][iLayer].size() ?
true :
false;
1307 if(secondCondition){
1308 thisRing = secondRing;
1311 if(firstCondition || secondCondition){
1312 ChHist[ec][st][rg][ch].EfficientRechits_good->Fill(iLayer+1);
1314 iR<allRechits[ec][st][thisRing][ch][iLayer].size();
1316 if(allRechits[ec][st][thisRing][ch][iLayer][iR].
second){
1317 usedInSegment[iLayer] = 1;
1321 usedInSegment[iLayer] = -1;
1326 missingLayers_rh[iLayer] =
true;
1329 printf(
"\t\tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",
id.
endcap(),
id.
station(),
id.
ring(),
id.chamber(),iLayer+1);
1336 firstCondition = allSegments[ec][st][rg][ch].size() ?
true :
false;
1337 secondCondition =
false;
1341 secondCondition = allSegments[ec][st][secondRing][ch].size() ?
true :
false;
1342 secondSize = allSegments[ec][st][secondRing][ch].size();
1343 if(secondCondition){
1344 thisRing = secondRing;
1347 if(firstCondition || secondCondition){
1348 if (printalot)
std::cout<<
"segments - start ec = "<<ec<<
" st = "<<st<<
" rg = "<<rg<<
" ch = "<<ch<<std::endl;
1349 StHist[ec][st].EfficientSegments_XY->Fill(ftsChamber.
position().
x(),ftsChamber.
position().
y());
1350 if(1==allSegments[ec][st][rg][ch].
size() + secondSize){
1351 globalDir = cscChamber->
toGlobal(allSegments[ec][st][thisRing][ch][0].
second);
1352 globalPos = cscChamber->
toGlobal(allSegments[ec][st][thisRing][ch][0].
first);
1353 StHist[ec][st].EfficientSegments_eta->Fill(fabs(ftsChamber.
position().
eta()));
1357 if (printalot)
std::cout<<
" fts.position() = "<<ftsChamber.
position()<<
" segPos = "<<globalPos<<
" res = "<<residual<< std::endl;
1358 StHist[ec][st].ResidualSegments->Fill(residual);
1360 for(
int iLayer=0;iLayer<6;++iLayer){
1361 if(printalot)
std::cout<<
" iLayer = "<<iLayer<<
" usedInSegment = "<<usedInSegment[iLayer]<<std::endl;
1362 if(0!=usedInSegment[iLayer]){
1363 if(-1==usedInSegment[iLayer]){
1364 ChHist[ec][st][rg][ch].InefficientSingleHits->Fill(iLayer+1);
1366 ChHist[ec][st][rg][ch].AllSingleHits->Fill(iLayer+1);
1368 firstCondition = allRechits[ec][st][rg][ch][iLayer].size() ?
true :
false;
1369 secondCondition =
false;
1371 secondCondition = allRechits[ec][st][secondRing][ch][iLayer].size() ?
true :
false;
1373 float stripAngle = 99999.;
1374 std::vector<float> posXY(2);
1375 bool oneSegment =
false;
1376 if(1==allSegments[ec][st][rg][ch].
size() + secondSize){
1379 linearExtrapolation(globalPos,globalDir, bp.position().z(), posXY);
1380 GlobalPoint gp_extrapol( posXY.at(0), posXY.at(1),bp.position().z());
1382 posXY.at(0) = lp_extrapol.
x();
1383 posXY.at(1) = lp_extrapol.y();
1387 if(firstCondition || secondCondition){
1388 ChHist[ec][st][rg][ch].EfficientRechits_inSegment->Fill(iLayer+1);
1390 ChHist[ec][st][rg][ch].Y_EfficientRecHits_inSegment[iLayer]->Fill(posXY.at(1));
1391 ChHist[ec][st][rg][ch].Phi_EfficientRecHits_inSegment[iLayer]->Fill(stripAngle);
1396 ChHist[ec][st][rg][ch].Y_InefficientRecHits_inSegment[iLayer]->Fill(posXY.at(1));
1397 ChHist[ec][st][rg][ch].Phi_InefficientRecHits_inSegment[iLayer]->Fill(stripAngle);
1403 StHist[ec][st].InefficientSegments_XY->Fill(ftsChamber.
position().
x(),ftsChamber.
position().
y());
1405 std::cout<<
"missing segment "<<std::endl;
1406 printf(
"\t\tendcap/station/ring/chamber: %i/%i/%i/%i\n",
id.
endcap(),
id.
station(),
id.
ring(),
id.chamber());
1411 ChHist[ec][st][rg][ch].EfficientRechits_good->Fill(8);
1412 if(allSegments[ec][st][rg][ch].
size()+secondSize<2){
1413 StHist[ec][st].AllSegments_eta->Fill(fabs(ftsChamber.
position().
eta()));
1415 ChHist[ec][st][rg][
id.chamber()-
FirstCh].EfficientRechits_inSegment->Fill(9);
1422 st =
id.station()-1;
1434 CLHEP::Hep3Vector&
p3, CLHEP::Hep3Vector& r3,
1440 p3.set(p3GV.
x(), p3GV.
y(), p3GV.
z());
1441 r3.set(r3GP.
x(), r3GP.
y(), r3GP.
z());
1462 float zSurface, std::vector <float> &posZY){
1463 double paramLine = lineParameter(initialPosition.
z(), zSurface, initialDirection.
z());
1464 double xPosition = extrapolate1D(initialPosition.
x(), initialDirection.
x(),paramLine);
1465 double yPosition = extrapolate1D(initialPosition.
y(), initialDirection.
y(),paramLine);
1467 posZY.push_back(xPosition);
1468 posZY.push_back(yPosition);
1472 double extrapolatedPosition = initPosition + initDirection*parameterOfTheLine;
1473 return extrapolatedPosition;
1477 double paramLine = (destZPosition-initZPosition)/initZDirection;
1485 float dy = outerPosition.y() - innerPosition.y();
1486 float dz = outerPosition.z() - innerPosition.z();
1507 return &*theService->propagator(propagatorName);
1534 propagatorName =
"SteppingHelixPropagatorAny";
1535 tSOSDest = propagator(propagatorName)->propagate(ftsStart, bpDest);
1541 bool triggerPassed =
true;
1542 std::vector<std::string> hlNames=triggerNames.
triggerNames();
1543 pointToTriggers.clear();
1544 for(
size_t imyT = 0;imyT<myTriggers.size();++imyT){
1545 for (
size_t iT=0; iT<hlNames.size(); ++iT) {
1551 if(hltR->wasrun(iT) &&
1554 TriggersFired->Fill(iT);
1557 if(hlNames[iT]==myTriggers[imyT]){
1558 pointToTriggers.push_back(iT);
1565 if(pointToTriggers.size()!=myTriggers.size()){
1566 pointToTriggers.clear();
1568 std::cout<<
" Not all trigger names found - all trigger specifications will be ignored. Check your cfg file!"<<std::endl;
1572 if(pointToTriggers.size()){
1574 std::cout<<
"The following triggers will be required in the event: "<<std::endl;
1575 for(
size_t imyT =0; imyT <pointToTriggers.size();++imyT){
1576 std::cout<<
" "<<hlNames[pointToTriggers[imyT]];
1585 if(!pointToTriggers.size()){
1587 std::cout<<
" No triggers specified in the configuration or all ignored - no trigger information will be considered"<<std::endl;
1590 for(
size_t imyT =0; imyT <pointToTriggers.size();++imyT){
1591 if(hltR->wasrun(pointToTriggers[imyT]) &&
1592 hltR->accept(pointToTriggers[imyT]) &&
1593 !hltR->error(pointToTriggers[imyT]) ){
1594 triggerPassed =
true;
1600 triggerPassed =
false;
1602 triggerPassed =
false;
1610 std::cout<<
" TriggerResults handle returns invalid state?! No trigger information will be considered"<<std::endl;
1614 std::cout<<
" Trigger passed: "<<triggerPassed<<std::endl;
1616 return triggerPassed;
1626 const float Ymin = -165;
1627 const float Ymax = 165;
1628 const int nYbins = int((Ymax - Ymin)/2);
1629 const float Layer_min = -0.5;
1630 const float Layer_max = 9.5;
1631 const int nLayer_bins = int(Layer_max - Layer_min);
1674 myTriggers = pset.
getParameter<std::vector <std::string> >(
"myTriggers");
1676 pointToTriggers.clear();
1680 nEventsAnalyzed = 0;
1687 theFile =
new TFile(rootFileName.c_str(),
"RECREATE");
1692 sprintf(SpecName,
"DataFlow");
1694 new TH1F(SpecName,
"Data flow;condition number;entries",40,-0.5,39.5);
1696 sprintf(SpecName,
"TriggersFired");
1698 new TH1F(SpecName,
"Triggers fired;trigger number;entries",140,-0.5,139.5);
1701 float minChan = -0.5;
1702 float maxChan = 49.5;
1704 sprintf(SpecName,
"ALCTPerEvent");
1705 ALCTPerEvent =
new TH1F(SpecName,
"ALCTs per event;N digis;entries",Chan,minChan,maxChan);
1707 sprintf(SpecName,
"CLCTPerEvent");
1708 CLCTPerEvent =
new TH1F(SpecName,
"CLCTs per event;N digis;entries",Chan,minChan,maxChan);
1710 sprintf(SpecName,
"recHitsPerEvent");
1711 recHitsPerEvent =
new TH1F(SpecName,
"RecHits per event;N digis;entries",150,-0.5,149.5);
1713 sprintf(SpecName,
"segmentsPerEvent");
1714 segmentsPerEvent =
new TH1F(SpecName,
"segments per event;N digis;entries",Chan,minChan,maxChan);
1718 map<std::string,bool>::iterator
iter;
1719 for(
int ec = 0;ec<2;++ec){
1720 for(
int st = 0;st<4;++st){
1722 sprintf(SpecName,
"Stations__E%d_S%d",ec+1, st+1);
1727 sprintf(SpecName,
"segmentChi2_ndf_St%d",st+1);
1728 StHist[ec][st].segmentChi2_ndf =
1729 new TH1F(SpecName,
"Chi2/ndf of a segment;chi2/ndf;entries",100,0.,20.);
1731 sprintf(SpecName,
"hitsInSegment_St%d",st+1);
1732 StHist[ec][st].hitsInSegment =
1733 new TH1F(SpecName,
"Number of hits in a segment;nHits;entries",7,-0.5,6.5);
1739 sprintf(SpecName,
"AllSegments_eta_St%d",st+1);
1740 StHist[ec][st].AllSegments_eta =
1741 new TH1F(SpecName,
"All segments in eta;eta;entries",Chan,minChan,maxChan);
1743 sprintf(SpecName,
"EfficientSegments_eta_St%d",st+1);
1744 StHist[ec][st].EfficientSegments_eta =
1745 new TH1F(SpecName,
"Efficient segments in eta;eta;entries",Chan,minChan,maxChan);
1747 sprintf(SpecName,
"ResidualSegments_St%d",st+1);
1748 StHist[ec][st].ResidualSegments =
1749 new TH1F(SpecName,
"Residual (segments);residual,cm;entries",75,0.,15.);
1755 float minChan2 = -800.;
1756 float maxChan2 = 800.;
1758 sprintf(SpecName,
"EfficientSegments_XY_St%d",st+1);
1759 StHist[ec][st].EfficientSegments_XY =
new TH2F(SpecName,
"Efficient segments in XY;X;Y",
1760 Chan,minChan,maxChan,Chan2,minChan2,maxChan2);
1761 sprintf(SpecName,
"InefficientSegments_XY_St%d",st+1);
1762 StHist[ec][st].InefficientSegments_XY =
new TH2F(SpecName,
"Inefficient segments in XY;X;Y",
1763 Chan,minChan,maxChan,Chan2,minChan2,maxChan2);
1768 sprintf(SpecName,
"EfficientALCT_momTheta_St%d",st+1);
1769 StHist[ec][st].EfficientALCT_momTheta =
new TH1F(SpecName,
"Efficient ALCT in theta (momentum);theta, rad;entries",
1770 Chan,minChan,maxChan);
1772 sprintf(SpecName,
"InefficientALCT_momTheta_St%d",st+1);
1773 StHist[ec][st].InefficientALCT_momTheta =
new TH1F(SpecName,
"Inefficient ALCT in theta (momentum);theta, rad;entries",
1774 Chan,minChan,maxChan);
1779 sprintf(SpecName,
"EfficientCLCT_momPhi_St%d",st+1);
1780 StHist[ec][st].EfficientCLCT_momPhi =
new TH1F(SpecName,
"Efficient CLCT in phi (momentum);phi, rad;entries",
1781 Chan,minChan,maxChan);
1783 sprintf(SpecName,
"InefficientCLCT_momPhi_St%d",st+1);
1784 StHist[ec][st].InefficientCLCT_momPhi =
new TH1F(SpecName,
"Inefficient CLCT in phi (momentum);phi, rad;entries",
1785 Chan,minChan,maxChan);
1788 for(
int rg = 0;rg<3;++rg){
1792 else if(1==rg && 3==st){
1796 if(0!=st && 0==rg && iChamber >18){
1800 sprintf(SpecName,
"Chambers__E%d_S%d_R%d_Chamber_%d",ec+1, st+1, rg+1,iChamber);
1805 sprintf(SpecName,
"EfficientRechits_inSegment_Ch%d",iChamber);
1806 ChHist[ec][st][rg][iChamber-
FirstCh].EfficientRechits_inSegment =
1807 new TH1F(SpecName,
"Existing RecHit given a segment;layers (1-6);entries",nLayer_bins,Layer_min,Layer_max);
1809 sprintf(SpecName,
"InefficientSingleHits_Ch%d",iChamber);
1810 ChHist[ec][st][rg][iChamber-
FirstCh].InefficientSingleHits =
1811 new TH1F(SpecName,
"Single RecHits not in the segment;layers (1-6);entries ",nLayer_bins,Layer_min,Layer_max);
1813 sprintf(SpecName,
"AllSingleHits_Ch%d",iChamber);
1814 ChHist[ec][st][rg][iChamber-
FirstCh].AllSingleHits =
1815 new TH1F(SpecName,
"Single RecHits given a segment; layers (1-6);entries",nLayer_bins,Layer_min,Layer_max);
1817 sprintf(SpecName,
"digiAppearanceCount_Ch%d",iChamber);
1818 ChHist[ec][st][rg][iChamber-
FirstCh].digiAppearanceCount =
1819 new TH1F(SpecName,
"Digi appearance (no-yes): segment(0,1), ALCT(2,3), CLCT(4,5), CorrLCT(6,7); digi type;entries",
1825 sprintf(SpecName,
"EfficientALCT_dydz_Ch%d",iChamber);
1826 ChHist[ec][st][rg][iChamber-
FirstCh].EfficientALCT_dydz =
1827 new TH1F(SpecName,
"Efficient ALCT; local dy/dz (ME 3 and 4 flipped);entries",
1828 Chan, minChan, maxChan);
1830 sprintf(SpecName,
"InefficientALCT_dydz_Ch%d",iChamber);
1831 ChHist[ec][st][rg][iChamber-
FirstCh].InefficientALCT_dydz =
1832 new TH1F(SpecName,
"Inefficient ALCT; local dy/dz (ME 3 and 4 flipped);entries",
1833 Chan, minChan, maxChan);
1838 sprintf(SpecName,
"EfficientCLCT_dxdz_Ch%d",iChamber);
1839 ChHist[ec][st][rg][iChamber-
FirstCh].EfficientCLCT_dxdz =
1840 new TH1F(SpecName,
"Efficient CLCT; local dxdz;entries",
1841 Chan, minChan, maxChan);
1843 sprintf(SpecName,
"InefficientCLCT_dxdz_Ch%d",iChamber);
1844 ChHist[ec][st][rg][iChamber-
FirstCh].InefficientCLCT_dxdz =
1845 new TH1F(SpecName,
"Inefficient CLCT; local dxdz;entries",
1846 Chan, minChan, maxChan);
1848 sprintf(SpecName,
"EfficientRechits_good_Ch%d",iChamber);
1849 ChHist[ec][st][rg][iChamber-
FirstCh].EfficientRechits_good =
1850 new TH1F(SpecName,
"Existing RecHit - sensitive area only;layers (1-6);entries",nLayer_bins,Layer_min,Layer_max);
1852 sprintf(SpecName,
"EfficientStrips_Ch%d",iChamber);
1853 ChHist[ec][st][rg][iChamber-
FirstCh].EfficientStrips =
1854 new TH1F(SpecName,
"Existing strip;layer (1-6); entries",nLayer_bins,Layer_min,Layer_max);
1856 sprintf(SpecName,
"EfficientWireGroups_Ch%d",iChamber);
1857 ChHist[ec][st][rg][iChamber-
FirstCh].EfficientWireGroups =
1858 new TH1F(SpecName,
"Existing WireGroups;layer (1-6); entries ",nLayer_bins,Layer_min,Layer_max);
1860 sprintf(SpecName,
"StripWiresCorrelations_Ch%d",iChamber);
1861 ChHist[ec][st][rg][iChamber-
FirstCh].StripWiresCorrelations =
1862 new TH1F(SpecName,
"StripWire correlations;; entries ",5,0.5,5.5);
1867 sprintf(SpecName,
"NoWires_momTheta_Ch%d",iChamber);
1868 ChHist[ec][st][rg][iChamber-
FirstCh].NoWires_momTheta =
1869 new TH1F(SpecName,
"No wires (all strips present) - in theta (momentum);theta, rad;entries",
1870 Chan,minChan,maxChan);
1875 sprintf(SpecName,
"NoStrips_momPhi_Ch%d",iChamber);
1876 ChHist[ec][st][rg][iChamber-
FirstCh].NoStrips_momPhi =
1877 new TH1F(SpecName,
"No strips (all wires present) - in phi (momentum);phi, rad;entries",
1878 Chan,minChan,maxChan);
1880 for(
int iLayer=0; iLayer<6;iLayer++){
1881 sprintf(SpecName,
"Y_InefficientRecHits_inSegment_Ch%d_L%d",iChamber,iLayer);
1882 ChHist[ec][st][rg][iChamber-
FirstCh].Y_InefficientRecHits_inSegment.push_back
1883 (
new TH1F(SpecName,
"Missing RecHit/layer in a segment (local system, whole chamber);Y, cm; entries",
1884 nYbins,Ymin, Ymax));
1886 sprintf(SpecName,
"Y_EfficientRecHits_inSegment_Ch%d_L%d",iChamber,iLayer);
1887 ChHist[ec][st][rg][iChamber-
FirstCh].Y_EfficientRecHits_inSegment.push_back
1888 (
new TH1F(SpecName,
"Efficient (extrapolated from the segment) RecHit/layer in a segment (local system, whole chamber);Y, cm; entries",
1889 nYbins,Ymin, Ymax));
1894 sprintf(SpecName,
"Phi_InefficientRecHits_inSegment_Ch%d_L%d",iChamber,iLayer);
1895 ChHist[ec][st][rg][iChamber-
FirstCh].Phi_InefficientRecHits_inSegment.push_back
1896 (
new TH1F(SpecName,
"Missing RecHit/layer in a segment (local system, whole chamber);Phi, rad; entries",
1897 Chan, minChan, maxChan));
1899 sprintf(SpecName,
"Phi_EfficientRecHits_inSegment_Ch%d_L%d",iChamber,iLayer);
1900 ChHist[ec][st][rg][iChamber-
FirstCh].Phi_EfficientRecHits_inSegment.push_back
1901 (
new TH1F(SpecName,
"Efficient (extrapolated from the segment) in a segment (local system, whole chamber);Phi, rad; entries",
1902 Chan, minChan, maxChan));
1906 sprintf(SpecName,
"Sim_Rechits_Ch%d",iChamber);
1907 ChHist[ec][st][rg][iChamber-
FirstCh].SimRechits =
1908 new TH1F(SpecName,
"Existing RecHit (Sim);layers (1-6);entries",nLayer_bins,Layer_min,Layer_max);
1910 sprintf(SpecName,
"Sim_Simhits_Ch%d",iChamber);
1911 ChHist[ec][st][rg][iChamber-
FirstCh].SimSimhits =
1912 new TH1F(SpecName,
"Existing SimHit (Sim);layers (1-6);entries",nLayer_bins,Layer_min,Layer_max);
1932 if (theService)
delete theService;
1937 std::vector<float> bins, Efficiency, EffError;
1938 std::vector<float> eff(2);
1941 std::map <std::string, bool> chamberTypes;
1942 chamberTypes[
"ME11"] =
false;
1943 chamberTypes[
"ME12"] =
false;
1944 chamberTypes[
"ME13"] =
false;
1945 chamberTypes[
"ME21"] =
false;
1946 chamberTypes[
"ME22"] =
false;
1947 chamberTypes[
"ME31"] =
false;
1948 chamberTypes[
"ME32"] =
false;
1949 chamberTypes[
"ME41"] =
false;
1951 map<std::string,bool>::iterator
iter;
1952 std::cout<<
" Writing proper histogram structure (patience)..."<<std::endl;
1953 for(
int ec = 0;ec<2;++ec){
1954 for(
int st = 0;st<4;++st){
1955 sprintf(SpecName,
"Stations__E%d_S%d",ec+1, st+1);
1957 StHist[ec][st].segmentChi2_ndf->Write();
1958 StHist[ec][st].hitsInSegment->Write();
1959 StHist[ec][st].AllSegments_eta->Write();
1960 StHist[ec][st].EfficientSegments_eta->Write();
1961 StHist[ec][st].ResidualSegments->Write();
1962 StHist[ec][st].EfficientSegments_XY->Write();
1963 StHist[ec][st].InefficientSegments_XY->Write();
1964 StHist[ec][st].EfficientALCT_momTheta->Write();
1965 StHist[ec][st].InefficientALCT_momTheta->Write();
1966 StHist[ec][st].EfficientCLCT_momPhi->Write();
1967 StHist[ec][st].InefficientCLCT_momPhi->Write();
1968 for(
int rg = 0;rg<3;++rg){
1972 else if(1==rg && 3==st){
1976 if(0!=st && 0==rg && iChamber >18){
1979 sprintf(SpecName,
"Chambers__E%d_S%d_R%d_Chamber_%d",ec+1, st+1, rg+1,iChamber);
1982 ChHist[ec][st][rg][iChamber-
FirstCh].EfficientRechits_inSegment->Write();
1983 ChHist[ec][st][rg][iChamber-
FirstCh].AllSingleHits->Write();
1984 ChHist[ec][st][rg][iChamber-
FirstCh].digiAppearanceCount->Write();
1985 ChHist[ec][st][rg][iChamber-
FirstCh].EfficientALCT_dydz->Write();
1986 ChHist[ec][st][rg][iChamber-
FirstCh].InefficientALCT_dydz->Write();
1987 ChHist[ec][st][rg][iChamber-
FirstCh].EfficientCLCT_dxdz->Write();
1988 ChHist[ec][st][rg][iChamber-
FirstCh].InefficientCLCT_dxdz->Write();
1989 ChHist[ec][st][rg][iChamber-
FirstCh].InefficientSingleHits->Write();
1990 ChHist[ec][st][rg][iChamber-
FirstCh].EfficientRechits_good->Write();
1991 ChHist[ec][st][rg][iChamber-
FirstCh].EfficientStrips->Write();
1992 ChHist[ec][st][rg][iChamber-
FirstCh].StripWiresCorrelations->Write();
1993 ChHist[ec][st][rg][iChamber-
FirstCh].NoWires_momTheta->Write();
1994 ChHist[ec][st][rg][iChamber-
FirstCh].NoStrips_momPhi->Write();
1995 ChHist[ec][st][rg][iChamber-
FirstCh].EfficientWireGroups->Write();
1996 for(
unsigned int iLayer = 0; iLayer< 6; iLayer++){
1997 ChHist[ec][st][rg][iChamber-
FirstCh].Y_InefficientRecHits_inSegment[iLayer]->Write();
1998 ChHist[ec][st][rg][iChamber-
FirstCh].Y_EfficientRecHits_inSegment[iLayer]->Write();
1999 ChHist[ec][st][rg][iChamber-
FirstCh].Phi_InefficientRecHits_inSegment[iLayer]->Write();
2000 ChHist[ec][st][rg][iChamber-
FirstCh].Phi_EfficientRecHits_inSegment[iLayer]->Write();
2002 ChHist[ec][st][rg][iChamber-
FirstCh].SimRechits->Write();
2003 ChHist[ec][st][rg][iChamber-
FirstCh].SimSimhits->Write();
2016 sprintf(SpecName,
"AllChambers");
2020 TriggersFired->Write();
2021 ALCTPerEvent->Write();
2022 CLCTPerEvent->Write();
2023 recHitsPerEvent->Write();
2024 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
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
const Propagator * propagator(std::string propagatorName) const
bool recHitSegment_Efficiencies(CSCDetId &cscDetId, const CSCChamber *cscChamber, FreeTrajectoryState &ftsChamber)
std::vector< CSCALCTDigi >::const_iterator const_iterator
T const * product() const
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)