29 printalot = (nEventsAnalyzed < int(printout_NEvents));
30 int iRun =
event.id().run();
31 int iEvent =
event.id().event();
32 if(0==fmod(
double (nEventsAnalyzed) ,
double(1000) )){
34 printf(
"\n==enter==CSCEfficiency===== run %i\tevent %i\tn Analyzed %i\n",iRun,iEvent,nEventsAnalyzed);
37 theService->update(eventSetup);
40 if (printalot) printf(
"\tget handles for digi collections\n");
45 if (printalot) printf(
"\tpass handles\n");
58 event.getByLabel(alctDigiTag_, alcts);
59 event.getByLabel(clctDigiTag_, clcts);
60 event.getByLabel(corrlctDigiTag_, correlatedlcts);
62 event.getByLabel( stripDigiTag_, strips);
63 event.getByLabel( wireDigiTag_, wires);
66 event.getByLabel(simHitTag, simhits);
68 event.getByLabel(rechitDigiTag_,rechits);
69 event.getByLabel(segmentDigiTag_, segments);
71 event.getByLabel(tracksTag,trackCollectionH);
75 if (printalot) printf(
"\tget the CSC geometry.\n");
83 bool triggerPassed =
true;
89 event.getByLabel(hlTriggerResults_,hltR);
91 triggerPassed = applyTrigger(hltR, triggerNames);
98 if(theService->magneticField()->inTesla(gpZero).mag2()<0.1){
106 fillDigiInfo(alcts, clcts, correlatedlcts, wires, strips, simhits, rechits, segments, cscGeom);
110 event.getByLabel(muonTag_,muons);
113 event.getByLabel(
"offlineBeamSpot", beamSpotHandle);
116 std::vector <reco::MuonCollection::const_iterator> goodMuons_it;
117 unsigned int nPositiveZ = 0;
118 unsigned int nNegativeZ = 0;
119 float muonOuterZPosition = -99999.;
121 if (printalot)
std::cout<<
" muons.size() = "<<muons->size() <<std::endl;
122 for ( reco::MuonCollection::const_iterator
muon = muons->begin();
muon != muons->end(); ++
muon ) {
126 " eta = "<<
muon->eta()<<
" phi = "<<
muon->phi()<<
129 muon->isGlobalMuon()<<
"/"<<
muon->isTrackerMuon()<<
"/"<<
muon->isStandAloneMuon()<<std::endl;
131 if(!(
muon->isTrackerMuon() &&
muon->isGlobalMuon())){
135 double relISO = (
muon->isolationR03().sumPt +
136 muon->isolationR03().emEt +
137 muon->isolationR03().hadEt)/
muon->track()->pt();
139 std::cout<<
" relISO = "<<relISO<<
" emVetoEt = "<<
muon->isolationR03().emVetoEt<<
" caloComp = "<<
148 if(
muon->track()->hitPattern().numberOfValidPixelHits()<1 ||
149 muon->track()->hitPattern().numberOfValidTrackerHits()<11 ||
150 muon->combinedMuon()->hitPattern().numberOfValidMuonHits()<1 ||
151 muon->combinedMuon()->normalizedChi2()>10. ||
152 muon->numberOfMatches()<2){
156 float zOuter =
muon->combinedMuon()->outerPosition().z();
157 float rhoOuter =
muon->combinedMuon()->outerPosition().rho();
158 bool passDepth =
true;
161 if ( fabs(zOuter) < 660. && rhoOuter > 400. && rhoOuter < 540.){
166 else if( fabs(zOuter) > 550. && fabs(zOuter) < 650. && rhoOuter < 300.){
171 else if ( fabs(zOuter) > 680. && fabs(zOuter) < 880. && rhoOuter < 540.){
178 goodMuons_it.push_back(
muon);
179 if(
muon->track()->momentum().z()>0.){
182 if(
muon->track()->momentum().z()<0.){
191 if (printalot)
std::cout<<
"Start track loop over "<<trackCollection.
size()<<
" tracks"<<std::endl;
198 std::cout<<
" nNegativeZ = "<<nNegativeZ<<
" nPositiveZ = "<<nPositiveZ<<std::endl;
200 if(nNegativeZ>1 || nPositiveZ>1){
203 bool trackOK =
false;
205 std::cout<<
" goodMuons_it.size() = "<<goodMuons_it.size()<<std::endl;
207 for(
size_t iM=0;iM<goodMuons_it.size();++iM){
211 float deltaR =
pow(track->
phi()-goodMuons_it[iM]->track()->phi(),2) +
212 pow(track->
eta()-goodMuons_it[iM]->track()->eta(),2);
213 deltaR =
sqrt(deltaR);
215 std::cout<<
" TR mu match to a tr: deltaR = "<<deltaR<<
" dPt = "<<
216 track->
pt()-goodMuons_it[iM]->track()->pt()<<std::endl;
218 if(deltaR>0.01 || fabs(track->
pt()-goodMuons_it[iM]->track()->pt())>0.1 ){
226 muonOuterZPosition = goodMuons_it[iM]->combinedMuon()->outerPosition().z();
233 std::cout<<
" failed: trackOK "<<std::endl;
240 if(trackCollection.
size()>2){
244 if(!
i && 2==trackCollection.
size()){
254 std::cout<<
"i track = "<<
i<<
" P = "<<track->
p()<<
" chi2/ndf = "<<track->
normalizedChi2()<<
" nSeg = "<<segments->size()<<std::endl;
255 std::cout<<
"quality undef/loose/tight/high/confirmed/goodIt/size "<<
291 float dpT_ov_pT = 0.;
292 if(fabs(track->
pt())>0.001){
293 dpT_ov_pT = track->
ptError()/ track->
pt();
300 if(track->
found()<minTrackHits){
304 if(!segments->size()){
308 if(magField && (track->
p()<
minP || track->
p()>maxP)){
312 if(magField && (dpT_ov_pT >0.5) ){
318 if (printalot)
std::cout<<
"good Track"<<std::endl;
321 chooseDirection(r3T_inner, r3T);
324 CLHEP::Hep3Vector p3_propagated, r3_propagated;
327 cov_propagated *= 1
e-20;
329 FreeTrajectoryState ftsStart = getFromCLHEP(p3T, r3T, charge, covT, &*(theService->magneticField()));
332 std::cout<<
" dump the very first FTS = "<<debug.
dumpFTS(ftsStart)<<std::endl;
345 std::vector< CSCDetId > refME;
346 for(
int iS=1;iS<5;++iS){
347 for(
int iR=1;iR<4;++iR){
351 else if(4==iS && iR>1){
354 refME.push_back(
CSCDetId(endcap, iS, iR, chamber));
358 for(
size_t iSt = 0; iSt<refME.size();++iSt){
360 std::cout<<
"loop iStatation = "<<iSt<<std::endl;
361 std::cout<<
"refME[iSt]: st = "<<refME[iSt].station()<<
" rg = "<<refME[iSt].ring()<<std::endl;
363 std::map <std::string, bool> chamberTypes;
364 chamberTypes[
"ME11"] =
false;
365 chamberTypes[
"ME12"] =
false;
366 chamberTypes[
"ME13"] =
false;
367 chamberTypes[
"ME21"] =
false;
368 chamberTypes[
"ME22"] =
false;
369 chamberTypes[
"ME31"] =
false;
370 chamberTypes[
"ME32"] =
false;
371 chamberTypes[
"ME41"] =
false;
372 const CSCChamber* cscChamber_base = cscGeom->chamber(refME[iSt].chamberId());
375 std::cout<<
" base iStation : eta = "<<cscGeom->idToDet(detId)->surface().position().eta()<<
" phi = "<<
376 cscGeom->idToDet(detId)->surface().position().phi() <<
" y = " <<cscGeom->idToDet(detId)->surface().position().y()<<std::endl;
381 tSOSDest = propagate(ftsStart, cscGeom->idToDet(detId)->surface());
384 if (printalot)
std::cout<<
" dump FTS end = "<<debug.
dumpFTS(ftsStart)<<std::endl;
385 getFromFTS(ftsStart, p3_propagated, r3_propagated, charge, cov_propagated);
386 float feta = fabs(r3_propagated.eta());
387 float phi = r3_propagated.phi();
389 ringCandidates(refME[iSt].
station(), feta, chamberTypes);
391 map<std::string,bool>::iterator iter;
394 for( iter = chamberTypes.begin(); iter != chamberTypes.end(); iter++ ) {
397 if(iter->second && (iterations-1)==int(iSt)){
399 std::cout<<
" Chamber type "<< iter->first<<
" is a candidate..."<<std::endl;
400 std::cout<<
" station() = "<< refME[iSt].station()<<
" ring() = "<<refME[iSt].ring()<<
" iSt = "<<iSt<<std::endl;
402 std::vector <int> coupleOfChambers;
404 chamberCandidates(refME[iSt].
station(), refME[iSt].
ring(), phi, coupleOfChambers);
406 for(
size_t iCh =0;iCh<coupleOfChambers.size();++iCh){
408 if (printalot)
std::cout<<
" Check chamber N = "<<coupleOfChambers.at(iCh)<<std::endl;;
409 if((!getAbsoluteEfficiency) && (
true == emptyChambers
412 [refME[iSt].
ring()-1]
413 [coupleOfChambers.at(iCh)-
FirstCh])){
417 const CSCChamber* cscChamber = cscGeom->chamber(theCSCId.chamberId());
418 const BoundPlane bpCh = cscGeom->idToDet(cscChamber->geographicalId())->surface();
420 float dz = fabs(bpCh.
position().
z() - zFTS);
427 if(!isIPdata && (zDistInner*zDistOuter>0. || fabs(zDistInner)<15. || fabs(zDistOuter)<15.)){
429 std::cout<<
" Not an intermediate (as defined) point... Skip."<<std::endl;
433 if(isIPdata && fabs(track->
eta())<1.8){
434 if(fabs(muonOuterZPosition) - fabs(bpCh.
position().
z())<0 ||
435 fabs(muonOuterZPosition-bpCh.
position().
z())<15.){
443 tSOSDest = propagate(ftsStart, cscGeom->idToDet(cscChamber->geographicalId())->surface());
448 if(printalot)
std::cout<<
"TSOS not valid! Break."<<std::endl;
453 if(printalot)
std::cout<<
" info: dz<0.1"<<std::endl;
457 bool inDeadZone =
false;
459 for(
int iLayer = 0;iLayer<6;++iLayer){
460 bool extrapolationPassed =
true;
462 std::cout<<
" iLayer = "<<iLayer<<
" dump FTS init = "<<debug.
dumpFTS(ftsInit)<<std::endl;
464 std::cout<<
"Surface to propagate to: pos = "<<cscChamber->layer(iLayer+1)->surface().position()<<
" eta = "
465 <<cscChamber->layer(iLayer+1)->surface().position().eta()<<
" phi = "
466 <<cscChamber->layer(iLayer+1)->surface().position().phi()<<std::endl;
469 tSOSDest = propagate(ftsInit, cscChamber->layer(iLayer+1)->surface());
472 if (printalot)
std::cout<<
" Propagation between layers successful: dump FTS end = "<<debug.
dumpFTS(ftsInit)<<std::endl;
473 getFromFTS(ftsInit, p3_propagated, r3_propagated, charge, cov_propagated);
476 if (printalot)
std::cout<<
"Propagation between layers not successful - notValid TSOS"<<std::endl;
477 extrapolationPassed =
false;
482 if(extrapolationPassed){
483 GlobalPoint theExtrapolationPoint(r3_propagated.x(),r3_propagated.y(),r3_propagated.z());
484 LocalPoint theLocalPoint = cscChamber->layer(iLayer+1)->toLocal(theExtrapolationPoint);
486 inDeadZone = ( inDeadZone ||
487 !inSensitiveLocalRegion(theLocalPoint.x(), theLocalPoint.y(),
488 refME[iSt].station(), refME[iSt].ring()));
490 std::cout<<
" Candidate chamber: extrapolated LocalPoint = "<<theLocalPoint<<
"inDeadZone = "<<inDeadZone<<std::endl;
505 if (printalot)
std::cout<<
"Do efficiencies..."<<std::endl;
508 bool angle_flag =
true; angle_flag = efficienciesPerChamber(theCSCId, cscChamber, ftsStart);
509 if(useDigis && angle_flag){
510 bool stripANDwire_flag; stripANDwire_flag = stripWire_Efficiencies(theCSCId, ftsStart);
513 bool recHitANDsegment_flag; recHitANDsegment_flag = recHitSegment_Efficiencies(theCSCId, cscChamber, ftsStart);
515 recSimHitEfficiency(theCSCId, ftsStart);
520 if(printalot)
std::cout<<
" Not in active area for all layers"<<std::endl;
530 if (printalot)
std::cout<<
" TSOS not valid..."<<std::endl;
535 if (printalot) printf(
"==exit===CSCEfficiency===== run %i\tevent %i\n\n",iRun,iEvent);
543 std::vector <double> chamberBounds(3);
544 float y_center = 99999.;
546 if(station>1 && station<5){
548 chamberBounds[0] = 66.46/2;
549 chamberBounds[1] = 127.15/2;
550 chamberBounds[2] = 323.06/2;
555 chamberBounds[0] = 54.00/2;
556 chamberBounds[1] = 125.71/2;
557 chamberBounds[2] = 189.66/2;
561 chamberBounds[0] = 61.40/2;
562 chamberBounds[1] = 125.71/2;
563 chamberBounds[2] = 169.70/2;
567 chamberBounds[0] = 69.01/2;
568 chamberBounds[1] = 125.65/2;
569 chamberBounds[2] = 149.42/2;
576 chamberBounds[0] = 63.40/2;
577 chamberBounds[1] = 92.10/2;
578 chamberBounds[2] = 164.16/2;
582 chamberBounds[0] = 51.00/2;
583 chamberBounds[1] = 83.74/2;
584 chamberBounds[2] = 174.49/2;
588 chamberBounds[0] = 30./2;
589 chamberBounds[1] = 60./2;
590 chamberBounds[2] = 160./2;
594 double yUp = chamberBounds[2] + y_center;
595 double yDown = - chamberBounds[2] + y_center;
596 double xBound1Shifted = chamberBounds[0]-distanceFromDeadZone;
597 double xBound2Shifted = chamberBounds[1]-distanceFromDeadZone;
598 double lineSlope = (yUp - yDown)/(xBound2Shifted-xBound1Shifted);
599 double lineConst = yUp - lineSlope*xBound2Shifted;
600 double yBoundary = lineSlope*
abs(xLocal) + lineConst;
601 pass = checkLocal(yLocal, yBoundary, station, ring);
608 std::vector <float> deadZoneCenter(6);
609 const float deadZoneHalf = 0.32*7/2;
610 float cutZone = deadZoneHalf + distanceFromDeadZone;
612 if(station>1 && station<5){
614 deadZoneCenter[0]= -162.48 ;
615 deadZoneCenter[1] = -81.8744;
616 deadZoneCenter[2] = -21.18165;
617 deadZoneCenter[3] = 39.51105;
618 deadZoneCenter[4] = 100.2939;
619 deadZoneCenter[5] = 160.58;
621 if(yLocal >yBoundary &&
622 ((yLocal> deadZoneCenter[0] + cutZone && yLocal< deadZoneCenter[1] - cutZone) ||
623 (yLocal> deadZoneCenter[1] + cutZone && yLocal< deadZoneCenter[2] - cutZone) ||
624 (yLocal> deadZoneCenter[2] + cutZone && yLocal< deadZoneCenter[3] - cutZone) ||
625 (yLocal> deadZoneCenter[3] + cutZone && yLocal< deadZoneCenter[4] - cutZone) ||
626 (yLocal> deadZoneCenter[4] + cutZone && yLocal< deadZoneCenter[5] - cutZone))){
632 deadZoneCenter[0]= -95.94 ;
633 deadZoneCenter[1] = -27.47;
634 deadZoneCenter[2] = 33.67;
635 deadZoneCenter[3] = 93.72;
638 deadZoneCenter[0]= -85.97 ;
639 deadZoneCenter[1] = -36.21;
640 deadZoneCenter[2] = 23.68;
641 deadZoneCenter[3] = 84.04;
644 deadZoneCenter[0]= -75.82;
645 deadZoneCenter[1] = -26.14;
646 deadZoneCenter[2] = 23.85;
647 deadZoneCenter[3] = 73.91;
649 if(yLocal >yBoundary &&
650 ((yLocal> deadZoneCenter[0] + cutZone && yLocal< deadZoneCenter[1] - cutZone) ||
651 (yLocal> deadZoneCenter[1] + cutZone && yLocal< deadZoneCenter[2] - cutZone) ||
652 (yLocal> deadZoneCenter[2] + cutZone && yLocal< deadZoneCenter[3] - cutZone))){
659 deadZoneCenter[0]= -83.155 ;
660 deadZoneCenter[1] = -22.7401;
661 deadZoneCenter[2] = 27.86665;
662 deadZoneCenter[3] = 81.005;
663 if(yLocal > yBoundary &&
664 ((yLocal> deadZoneCenter[0] + cutZone && yLocal< deadZoneCenter[1] - cutZone) ||
665 (yLocal> deadZoneCenter[1] + cutZone && yLocal< deadZoneCenter[2] - cutZone) ||
666 (yLocal> deadZoneCenter[2] + cutZone && yLocal< deadZoneCenter[3] - cutZone))){
671 deadZoneCenter[0]= -86.285 ;
672 deadZoneCenter[1] = -32.88305;
673 deadZoneCenter[2] = 32.867423;
674 deadZoneCenter[3] = 88.205;
675 if(yLocal > (yBoundary) &&
676 ((yLocal> deadZoneCenter[0] + cutZone && yLocal< deadZoneCenter[1] - cutZone) ||
677 (yLocal> deadZoneCenter[1] + cutZone && yLocal< deadZoneCenter[2] - cutZone) ||
678 (yLocal> deadZoneCenter[2] + cutZone && yLocal< deadZoneCenter[3] - cutZone))){
683 deadZoneCenter[0]= -81.0;
684 deadZoneCenter[1] = 81.0;
685 if(yLocal > (yBoundary) &&
686 ((yLocal> deadZoneCenter[0] + cutZone && yLocal< deadZoneCenter[1] - cutZone) )){
703 for(
int iE=0;iE<2;iE++){
704 for(
int iS=0;iS<4;iS++){
705 for(
int iR=0;iR<4;iR++){
706 for(
int iC=0;iC<
NumCh;iC++){
707 allSegments[iE][iS][iR][iC].clear();
708 allCLCT[iE][iS][iR][iC] = allALCT[iE][iS][iR][iC] = allCorrLCT[iE][iS][iR][iC] =
false;
709 for(
int iL=0;iL<6;iL++){
710 allStrips[iE][iS][iR][iC][iL].clear();
711 allWG[iE][iS][iR][iC][iL].clear();
712 allRechits[iE][iS][iR][iC][iL].clear();
713 allSimhits[iE][iS][iR][iC][iL].clear();
721 fillLCT_info(alcts, clcts, correlatedlcts);
722 fillWG_info(wires, cscGeom);
723 fillStrips_info(strips);
725 fillRechitsSegments_info(rechits, segments, cscGeom);
727 fillSimhit_info(simhits);
742 range.first; digiIt!=range.second;
745 if((*digiIt).isValid()){
746 allALCT[
id.endcap()-1][
id.station()-1][
id.ring()-1][
id.chamber()-
FirstCh] =
true;
750 ALCTPerEvent->Fill(nSize);
756 std::vector<CSCCLCTDigi>::const_iterator digiIt = (*j).second.first;
757 std::vector<CSCCLCTDigi>::const_iterator
last = (*j).second.second;
758 for( ; digiIt !=
last; ++digiIt) {
760 if((*digiIt).isValid()){
761 allCLCT[
id.endcap()-1][
id.station()-1][
id.ring()-1][
id.chamber()-
FirstCh] =
true;
765 CLCTPerEvent->Fill(nSize);
769 std::vector<CSCCorrelatedLCTDigi>::const_iterator digiIt = (*j).second.first;
770 std::vector<CSCCorrelatedLCTDigi>::const_iterator
last = (*j).second.second;
771 for( ; digiIt !=
last; ++digiIt) {
773 if((*digiIt).isValid()){
774 allCorrLCT[
id.endcap()-1][
id.station()-1][
id.ring()-1][
id.chamber()-
FirstCh] =
true;
784 const CSCLayer *layer_p = cscGeom->layer (
id);
788 const std::vector<float> LayerBounds = layerGeom->
parameters ();
789 std::vector<CSCWireDigi>::const_iterator digiItr = (*j).second.first;
790 std::vector<CSCWireDigi>::const_iterator
last = (*j).second.second;
792 for( ; digiItr !=
last; ++digiItr) {
793 std::pair < int, float > WG_pos(digiItr->getWireGroup(), layerGeom->
yOfWireGroup(digiItr->getWireGroup()));
794 std::pair <std::pair < int, float >,
int > LayerSignal(WG_pos, digiItr->getTimeBin());
797 allWG[
id.endcap()-1][
id.station()-1][
id.ring()-1][
id.chamber()-
FirstCh]
798 [
id.layer()-1].push_back(LayerSignal);
812 int largestADCValue = -1;
813 int largestStrip = -1;
814 std::vector<CSCStripDigi>::const_iterator digiItr = (*j).second.first;
815 std::vector<CSCStripDigi>::const_iterator
last = (*j).second.second;
816 for( ; digiItr !=
last; ++digiItr) {
817 int maxADC=largestADCValue;
818 int myStrip = digiItr->getStrip();
819 std::vector<int> myADCVals = digiItr->getADCCounts();
820 bool thisStripFired =
false;
821 float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
824 float peakADC = -1000.;
826 for (
unsigned int iCount = 0; iCount < myADCVals.size(); iCount++) {
827 diff = (float)myADCVals[iCount]-thisPedestal;
828 if (diff > threshold) {
829 thisStripFired =
true;
830 if (myADCVals[iCount] > largestADCValue) {
831 largestADCValue = myADCVals[iCount];
832 largestStrip = myStrip;
835 if (diff > threshold && diff > peakADC) {
840 if(largestADCValue>maxADC){
841 maxADC = largestADCValue;
842 std::pair <int, float> LayerSignal (myStrip, peakADC);
846 allStrips[
id.endcap()-1][
id.station()-1][
id.ring()-1][
id.chamber()-1][
id.layer()-1].clear();
847 allStrips[
id.endcap()-1][
id.station()-1][
id.ring()-1][
id.chamber()-1][
id.layer()-1].push_back(LayerSignal);
854 edm::PSimHitContainer::const_iterator dSHsimIter;
855 for (dSHsimIter = simhits->begin(); dSHsimIter != simhits->end(); dSHsimIter++){
858 std::pair <LocalPoint, int> simHitPos((*dSHsimIter).localPosition(), (*dSHsimIter).particleType());
871 printf(
" The size of the rechit collection is %i\n",
int(rechits->size()));
874 recHitsPerEvent->Fill(rechits->size());
877 for (recIt = rechits->begin(); recIt != rechits->end(); recIt++) {
881 const CSCLayer* csclayer = cscGeom->layer(
id);
882 LocalPoint rhitlocal = (*recIt).localPosition();
883 LocalError rerrlocal = (*recIt).localPositionError();
885 printf(
"\t\tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",
id.
endcap(),
id.
station(),
id.
ring(),
id.chamber(),
id.layer());
886 printf(
"\t\tx,y,z: %f, %f, %f\texx,eey,exy: %f, %f, %f\tglobal x,y,z: %f, %f, %f \n",
887 rhitlocal.
x(), rhitlocal.
y(), rhitlocal.
z(), rerrlocal.
xx(), rerrlocal.
yy(), rerrlocal.
xy(),
888 rhitglobal.
x(), rhitglobal.
y(), rhitglobal.
z());
890 std::pair <LocalPoint, bool> recHitPos((*recIt).localPosition(),
false);
891 allRechits[
id.endcap()-1][
id.station()-1][
id.ring()-1][
id.chamber()-
FirstCh][
id.layer()-1].push_back(recHitPos);
894 for(
int iE=0;iE<2;iE++){
895 for(
int iS=0;iS<4;iS++){
896 for(
int iR=0;iR<4;iR++){
897 for(
int iC=0;iC<
NumCh;iC++){
899 for(
int iL=0;iL<6;iL++){
900 if(allRechits[iE][iS][iR][iC][iL].
size()){
905 emptyChambers[iE][iS][iR][iC] =
false;
908 emptyChambers[iE][iS][iR][iC] =
true;
917 printf(
" The size of the segment collection is %i\n",
int(segments->size()));
920 segmentsPerEvent->Fill(segments->size());
923 StHist[
id.endcap()-1][
id.station()-1].segmentChi2_ndf->Fill((*it).chi2()/(*it).degreesOfFreedom());
924 StHist[
id.endcap()-1][
id.station()-1].hitsInSegment->Fill((*it).nRecHits());
926 printf(
"\tendcap/station/ring/chamber: %i %i %i %i\n",
928 std::cout<<
"\tposition(loc) = "<<(*it).localPosition()<<
" error(loc) = "<<(*it).localPositionError()<<std::endl;
929 std::cout<<
"\t chi2/ndf = "<<(*it).chi2()/(*it).degreesOfFreedom()<<
" nhits = "<<(*it).nRecHits() <<std::endl;
932 allSegments[
id.endcap()-1][
id.station()-1][
id.ring()-1][
id.chamber()-
FirstCh].push_back
933 (make_pair((*it).localPosition(), (*it).localDirection()));
938 std::vector<CSCRecHit2D> theseRecHits = (*it).specificRecHits();
939 int nRH = (*it).nRecHits();
941 printf(
"\tGet the recHits for this segment.\t");
942 printf(
" nRH = %i\n",nRH);
946 for ( vector<CSCRecHit2D>::const_iterator iRH = theseRecHits.begin(); iRH != theseRecHits.end(); iRH++) {
950 printf(
"\t%i RH\tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",
957 float xDiff = iRH->localPosition().
x() -
959 float yDiff = iRH->localPosition().y() -
961 if(fabs(xDiff)<0.0001 && fabs(yDiff)<0.0001){
962 std::pair <LocalPoint, bool>
966 std::cout<<
" number of the rechit (from zero) in the segment = "<< jRH<<std::endl;
979 if(feta>0.85 && feta<1.18){
980 chamberTypes[
"ME13"] =
true;
982 if(feta>1.18 && feta<1.7){
983 chamberTypes[
"ME12"] =
true;
985 if(feta>1.5 && feta<2.45){
986 chamberTypes[
"ME11"] =
true;
990 if(feta>0.95 && feta<1.6){
991 chamberTypes[
"ME22"] =
true;
994 if(feta>1.55 && feta<2.45){
995 chamberTypes[
"ME21"] =
true;
999 if(feta>1.08 && feta<1.72){
1000 chamberTypes[
"ME32"] =
true;
1003 if(feta>1.69 && feta<2.45){
1004 chamberTypes[
"ME31"] =
true;
1008 if(feta>1.78 && feta<2.45){
1009 chamberTypes[
"ME41"] =
true;
1018 coupleOfChambers.clear();
1020 float phi_zero = 0.;
1021 float phi_const = 2.*
M_PI/36.;
1022 int last_chamber = 36;
1023 int first_chamber = 1;
1024 if(1 != station && 1==ring){
1029 if (printalot)
std::cout<<
" info: negative phi = "<<phi<<std::endl;
1032 float chamber_float = (phi - phi_zero)/phi_const;
1033 int chamber_int = int(chamber_float);
1034 if (chamber_float -
float(chamber_int) -0.5 <0.){
1035 if(0!=chamber_int ){
1036 coupleOfChambers.push_back(chamber_int);
1039 coupleOfChambers.push_back(last_chamber);
1041 coupleOfChambers.push_back(chamber_int+1);
1045 coupleOfChambers.push_back(chamber_int+1);
1046 if(last_chamber!=chamber_int+1){
1047 coupleOfChambers.push_back(chamber_int+2);
1050 coupleOfChambers.push_back(first_chamber);
1053 if (printalot)
std::cout<<
" phi = "<<phi<<
" phi_zero = "<<phi_zero<<
" phi_const = "<<phi_const<<
1054 " candidate chambers: first ch = "<<coupleOfChambers[0]<<
" second ch = "<<coupleOfChambers[1]<<std::endl;
1059 int ec, st, rg, ch, secondRing;
1060 returnTypes(
id, ec, st, rg, ch, secondRing);
1065 std::cout<<
" local dir = "<<localDir<<std::endl;
1068 float dxdz = localDir.
x()/localDir.
z();
1069 float dydz = localDir.
y()/localDir.
z();
1072 std::cout<<
"st 3 or 4 ... flip dy/dz"<<std::endl;
1081 if(applyIPangleCuts){
1082 if(dydz>local_DY_DZ_Max || dydz<local_DY_DZ_Min || fabs(dxdz)>local_DX_DZ_Max){
1088 bool firstCondition = allSegments[ec][st][rg][ch].size() ?
true :
false;
1089 bool secondCondition =
false;
1092 secondCondition = allSegments[ec][st][secondRing][ch].size() ?
true :
false;
1094 if(firstCondition || secondCondition){
1096 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(1);
1101 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(0);
1105 bool missingALCT =
false;
1106 bool missingCLCT =
false;
1109 firstCondition = allALCT[ec][st][rg][ch];
1110 secondCondition =
false;
1112 secondCondition = allALCT[ec][st][secondRing][ch];
1114 if(firstCondition || secondCondition){
1116 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(3);
1119 if(fabs(dxdz)<local_DX_DZ_Max){
1120 StHist[ec][st].EfficientALCT_momTheta->Fill(ftsChamber.
momentum().
theta());
1121 ChHist[ec][st][rg][ch].EfficientALCT_dydz->Fill(dydz);
1127 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(2);
1129 if(fabs(dxdz)<local_DX_DZ_Max){
1130 StHist[ec][st].InefficientALCT_momTheta->Fill(ftsChamber.
momentum().
theta());
1131 ChHist[ec][st][rg][ch].InefficientALCT_dydz->Fill(dydz);
1134 std::cout<<
" missing ALCT (dy/dz = "<<dydz<<
")";
1135 printf(
"\t\tendcap/station/ring/chamber: %i/%i/%i/%i\n",ec+1,st+1,rg+1,ch+1);
1140 firstCondition = allCLCT[ec][st][rg][ch];
1141 secondCondition =
false;
1143 secondCondition = allCLCT[ec][st][secondRing][ch];
1145 if(firstCondition || secondCondition){
1147 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(5);
1149 if(dydz<local_DY_DZ_Max && dydz>local_DY_DZ_Min){
1150 StHist[ec][st].EfficientCLCT_momPhi->Fill(ftsChamber.
momentum().
phi() );
1151 ChHist[ec][st][rg][ch].EfficientCLCT_dxdz->Fill(dxdz);
1157 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(4);
1159 if(dydz<local_DY_DZ_Max && dydz>local_DY_DZ_Min){
1160 StHist[ec][st].InefficientCLCT_momPhi->Fill(ftsChamber.
momentum().
phi());
1161 ChHist[ec][st][rg][ch].InefficientCLCT_dxdz->Fill(dxdz);
1164 std::cout<<
" missing CLCT (dx/dz = "<<dxdz<<
")";
1165 printf(
"\t\tendcap/station/ring/chamber: %i/%i/%i/%i\n",ec+1,st+1,rg+1,ch+1);
1170 firstCondition = allCorrLCT[ec][st][rg][ch];
1171 secondCondition =
false;
1173 secondCondition = allCorrLCT[ec][st][secondRing][ch];
1175 if(firstCondition || secondCondition){
1176 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(7);
1179 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(6);
1188 int ec, st, rg, ch, secondRing;
1189 returnTypes(
id, ec, st, rg, ch, secondRing);
1191 bool firstCondition, secondCondition;
1192 int missingLayers_s = 0;
1193 int missingLayers_wg = 0;
1194 for(
int iLayer=0;iLayer<6;iLayer++){
1197 printf(
"\t%i swEff: \tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",
1199 std::cout<<
" size S = "<<allStrips[
id.endcap()-1][
id.station()-1][
id.ring()-1][
id.chamber()-
FirstCh][iLayer].size()<<
1200 "size W = "<<allWG[
id.endcap()-1][
id.station()-1][
id.ring()-1][
id.chamber()-
FirstCh][iLayer].size()<<std::endl;
1203 firstCondition = allStrips[ec][st][rg][ch][iLayer].size() ?
true :
false;
1205 secondCondition =
false;
1207 secondCondition = allStrips[ec][st][secondRing][ch][iLayer].size() ?
true :
false;
1209 if(firstCondition || secondCondition){
1210 ChHist[ec][st][rg][ch].EfficientStrips->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);
1219 firstCondition = allWG[ec][st][rg][ch][iLayer].size() ?
true :
false;
1220 secondCondition =
false;
1222 secondCondition = allWG[ec][st][secondRing][ch][iLayer].size() ?
true :
false;
1224 if(firstCondition || secondCondition){
1225 ChHist[ec][st][rg][ch].EfficientWireGroups->Fill(iLayer+1);
1230 printf(
"\t\tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",
id.
endcap(),
id.
station(),
id.
ring(),
id.chamber(),iLayer+1);
1235 if(6!=missingLayers_s){
1236 ChHist[ec][st][rg][ch].EfficientStrips->Fill(8);
1238 if(6!=missingLayers_wg){
1239 ChHist[ec][st][rg][ch].EfficientWireGroups->Fill(8);
1241 ChHist[ec][st][rg][ch].EfficientStrips->Fill(9);
1242 ChHist[ec][st][rg][ch].EfficientWireGroups->Fill(9);
1244 ChHist[ec][st][rg][ch].StripWiresCorrelations->Fill(1);
1245 if(missingLayers_s!=missingLayers_wg){
1246 ChHist[ec][st][rg][ch].StripWiresCorrelations->Fill(2);
1247 if(6==missingLayers_wg){
1248 ChHist[ec][st][rg][ch].StripWiresCorrelations->Fill(3);
1249 ChHist[ec][st][rg][ch].NoWires_momTheta->Fill(ftsChamber.
momentum().
theta());
1251 if(6==missingLayers_s){
1252 ChHist[ec][st][rg][ch].StripWiresCorrelations->Fill(4);
1253 ChHist[ec][st][rg][ch].NoStrips_momPhi->Fill(ftsChamber.
momentum().
theta());
1256 else if(6==missingLayers_s){
1257 ChHist[ec][st][rg][ch].StripWiresCorrelations->Fill(5);
1264 int ec, st, rg, ch, secondRing;
1265 returnTypes(
id, ec, st, rg, ch, secondRing);
1266 bool firstCondition, secondCondition;
1267 for(
int iLayer=0; iLayer<6;iLayer++){
1268 firstCondition = allSimhits[ec][st][rg][ch][iLayer].size() ?
true :
false;
1269 secondCondition =
false;
1272 secondCondition = allSimhits[ec][st][secondRing][ch][iLayer].size() ?
true :
false;
1273 if(secondCondition){
1274 thisRing = secondRing;
1277 if(firstCondition || secondCondition){
1279 iSH<allSimhits[ec][st][thisRing][ch][iLayer].size();
1282 fabs(allSimhits[ec][st][thisRing][ch][iLayer][iSH].
second)){
1283 ChHist[ec][st][rg][ch].SimSimhits->Fill(iLayer+1);
1284 if(allRechits[ec][st][thisRing][ch][iLayer].
size()){
1285 ChHist[ec][st][rg][ch].SimRechits->Fill(iLayer+1);
1311 int ec, st, rg, ch, secondRing;
1312 returnTypes(
id, ec, st, rg, ch, secondRing);
1313 bool firstCondition, secondCondition;
1315 std::vector <bool> missingLayers_rh(6);
1316 std::vector <int> usedInSegment(6);
1318 if(printalot)
std::cout<<
"RecHits eff"<<std::endl;
1319 for(
int iLayer=0;iLayer<6;++iLayer){
1320 firstCondition = allRechits[ec][st][rg][ch][iLayer].size() ?
true :
false;
1321 secondCondition =
false;
1324 secondCondition = allRechits[ec][st][secondRing][ch][iLayer].size() ?
true :
false;
1325 if(secondCondition){
1326 thisRing = secondRing;
1329 if(firstCondition || secondCondition){
1330 ChHist[ec][st][rg][ch].EfficientRechits_good->Fill(iLayer+1);
1332 iR<allRechits[ec][st][thisRing][ch][iLayer].size();
1334 if(allRechits[ec][st][thisRing][ch][iLayer][iR].
second){
1335 usedInSegment[iLayer] = 1;
1339 usedInSegment[iLayer] = -1;
1344 missingLayers_rh[iLayer] =
true;
1347 printf(
"\t\tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",
id.
endcap(),
id.
station(),
id.
ring(),
id.chamber(),iLayer+1);
1354 firstCondition = allSegments[ec][st][rg][ch].size() ?
true :
false;
1355 secondCondition =
false;
1359 secondCondition = allSegments[ec][st][secondRing][ch].size() ?
true :
false;
1360 secondSize = allSegments[ec][st][secondRing][ch].size();
1361 if(secondCondition){
1362 thisRing = secondRing;
1365 if(firstCondition || secondCondition){
1366 if (printalot)
std::cout<<
"segments - start ec = "<<ec<<
" st = "<<st<<
" rg = "<<rg<<
" ch = "<<ch<<std::endl;
1367 StHist[ec][st].EfficientSegments_XY->Fill(ftsChamber.
position().
x(),ftsChamber.
position().
y());
1368 if(1==allSegments[ec][st][rg][ch].
size() + secondSize){
1369 globalDir = cscChamber->
toGlobal(allSegments[ec][st][thisRing][ch][0].
second);
1370 globalPos = cscChamber->
toGlobal(allSegments[ec][st][thisRing][ch][0].
first);
1371 StHist[ec][st].EfficientSegments_eta->Fill(fabs(ftsChamber.
position().
eta()));
1375 if (printalot)
std::cout<<
" fts.position() = "<<ftsChamber.
position()<<
" segPos = "<<globalPos<<
" res = "<<residual<< std::endl;
1376 StHist[ec][st].ResidualSegments->Fill(residual);
1378 for(
int iLayer=0;iLayer<6;++iLayer){
1379 if(printalot)
std::cout<<
" iLayer = "<<iLayer<<
" usedInSegment = "<<usedInSegment[iLayer]<<std::endl;
1380 if(0!=usedInSegment[iLayer]){
1381 if(-1==usedInSegment[iLayer]){
1382 ChHist[ec][st][rg][ch].InefficientSingleHits->Fill(iLayer+1);
1384 ChHist[ec][st][rg][ch].AllSingleHits->Fill(iLayer+1);
1386 firstCondition = allRechits[ec][st][rg][ch][iLayer].size() ?
true :
false;
1387 secondCondition =
false;
1389 secondCondition = allRechits[ec][st][secondRing][ch][iLayer].size() ?
true :
false;
1391 float stripAngle = 99999.;
1392 std::vector<float> posXY(2);
1393 bool oneSegment =
false;
1394 if(1==allSegments[ec][st][rg][ch].
size() + secondSize){
1397 linearExtrapolation(globalPos,globalDir, bp.
position().
z(), posXY);
1400 posXY.at(0) = lp_extrapol.
x();
1401 posXY.at(1) = lp_extrapol.y();
1405 if(firstCondition || secondCondition){
1406 ChHist[ec][st][rg][ch].EfficientRechits_inSegment->Fill(iLayer+1);
1408 ChHist[ec][st][rg][ch].Y_EfficientRecHits_inSegment[iLayer]->Fill(posXY.at(1));
1409 ChHist[ec][st][rg][ch].Phi_EfficientRecHits_inSegment[iLayer]->Fill(stripAngle);
1414 ChHist[ec][st][rg][ch].Y_InefficientRecHits_inSegment[iLayer]->Fill(posXY.at(1));
1415 ChHist[ec][st][rg][ch].Phi_InefficientRecHits_inSegment[iLayer]->Fill(stripAngle);
1421 StHist[ec][st].InefficientSegments_XY->Fill(ftsChamber.
position().
x(),ftsChamber.
position().
y());
1423 std::cout<<
"missing segment "<<std::endl;
1424 printf(
"\t\tendcap/station/ring/chamber: %i/%i/%i/%i\n",
id.
endcap(),
id.
station(),
id.
ring(),
id.chamber());
1429 ChHist[ec][st][rg][ch].EfficientRechits_good->Fill(8);
1430 if(allSegments[ec][st][rg][ch].
size()+secondSize<2){
1431 StHist[ec][st].AllSegments_eta->Fill(fabs(ftsChamber.
position().
eta()));
1433 ChHist[ec][st][rg][
id.chamber()-
FirstCh].EfficientRechits_inSegment->Fill(9);
1440 st =
id.station()-1;
1452 CLHEP::Hep3Vector&
p3, CLHEP::Hep3Vector& r3,
1458 p3.set(p3GV.
x(), p3GV.
y(), p3GV.
z());
1459 r3.set(r3GP.
x(), r3GP.
y(), r3GP.
z());
1480 float zSurface, std::vector <float> &posZY){
1481 double paramLine = lineParameter(initialPosition.
z(), zSurface, initialDirection.
z());
1482 double xPosition = extrapolate1D(initialPosition.
x(), initialDirection.
x(),paramLine);
1483 double yPosition = extrapolate1D(initialPosition.
y(), initialDirection.
y(),paramLine);
1485 posZY.push_back(xPosition);
1486 posZY.push_back(yPosition);
1490 double extrapolatedPosition = initPosition + initDirection*parameterOfTheLine;
1491 return extrapolatedPosition;
1495 double paramLine = (destZPosition-initZPosition)/initZDirection;
1503 float dy = outerPosition.y() - innerPosition.y();
1504 float dz = outerPosition.z() - innerPosition.z();
1525 return &*theService->propagator(propagatorName);
1531 std::string propagatorName;
1552 propagatorName =
"SteppingHelixPropagatorAny";
1553 tSOSDest =
propagator(propagatorName)->propagate(ftsStart, bpDest);
1559 bool triggerPassed =
true;
1560 std::vector<std::string> hlNames=triggerNames.
triggerNames();
1561 pointToTriggers.clear();
1562 for(
size_t imyT = 0;imyT<myTriggers.size();++imyT){
1563 for (
size_t iT=0; iT<hlNames.size(); ++iT) {
1569 if(hltR->wasrun(iT) &&
1572 TriggersFired->Fill(iT);
1575 if(hlNames[iT]==myTriggers[imyT]){
1576 pointToTriggers.push_back(iT);
1583 if(pointToTriggers.size()!=myTriggers.size()){
1584 pointToTriggers.clear();
1586 std::cout<<
" Not all trigger names found - all trigger specifications will be ignored. Check your cfg file!"<<std::endl;
1590 if(pointToTriggers.size()){
1592 std::cout<<
"The following triggers will be required in the event: "<<std::endl;
1593 for(
size_t imyT =0; imyT <pointToTriggers.size();++imyT){
1594 std::cout<<
" "<<hlNames[pointToTriggers[imyT]];
1603 if(!pointToTriggers.size()){
1605 std::cout<<
" No triggers specified in the configuration or all ignored - no trigger information will be considered"<<std::endl;
1608 for(
size_t imyT =0; imyT <pointToTriggers.size();++imyT){
1609 if(hltR->wasrun(pointToTriggers[imyT]) &&
1610 hltR->accept(pointToTriggers[imyT]) &&
1611 !hltR->error(pointToTriggers[imyT]) ){
1612 triggerPassed =
true;
1618 triggerPassed =
false;
1620 triggerPassed =
false;
1628 std::cout<<
" TriggerResults handle returns invalid state?! No trigger information will be considered"<<std::endl;
1632 std::cout<<
" Trigger passed: "<<triggerPassed<<std::endl;
1634 return triggerPassed;
1644 const float Ymin = -165;
1645 const float Ymax = 165;
1646 const int nYbins = int((Ymax - Ymin)/2);
1647 const float Layer_min = -0.5;
1648 const float Layer_max = 9.5;
1649 const int nLayer_bins = int(Layer_max - Layer_min);
1689 myTriggers = pset.
getParameter<std::vector <std::string> >(
"myTriggers");
1691 pointToTriggers.clear();
1695 nEventsAnalyzed = 0;
1699 std::string
Path =
"AllChambers/";
1700 std::string FullName;
1702 theFile =
new TFile(rootFileName.c_str(),
"RECREATE");
1707 sprintf(SpecName,
"DataFlow");
1709 new TH1F(SpecName,
"Data flow;condition number;entries",40,-0.5,39.5);
1711 sprintf(SpecName,
"TriggersFired");
1713 new TH1F(SpecName,
"Triggers fired;trigger number;entries",140,-0.5,139.5);
1716 float minChan = -0.5;
1717 float maxChan = 49.5;
1719 sprintf(SpecName,
"ALCTPerEvent");
1720 ALCTPerEvent =
new TH1F(SpecName,
"ALCTs per event;N digis;entries",Chan,minChan,maxChan);
1722 sprintf(SpecName,
"CLCTPerEvent");
1723 CLCTPerEvent =
new TH1F(SpecName,
"CLCTs per event;N digis;entries",Chan,minChan,maxChan);
1725 sprintf(SpecName,
"recHitsPerEvent");
1726 recHitsPerEvent =
new TH1F(SpecName,
"RecHits per event;N digis;entries",150,-0.5,149.5);
1728 sprintf(SpecName,
"segmentsPerEvent");
1729 segmentsPerEvent =
new TH1F(SpecName,
"segments per event;N digis;entries",Chan,minChan,maxChan);
1733 map<std::string,bool>::iterator iter;
1734 for(
int ec = 0;ec<2;++ec){
1735 for(
int st = 0;st<4;++st){
1737 sprintf(SpecName,
"Stations__E%d_S%d",ec+1, st+1);
1742 sprintf(SpecName,
"segmentChi2_ndf_St%d",st+1);
1743 StHist[ec][st].segmentChi2_ndf =
1744 new TH1F(SpecName,
"Chi2/ndf of a segment;chi2/ndf;entries",100,0.,20.);
1746 sprintf(SpecName,
"hitsInSegment_St%d",st+1);
1747 StHist[ec][st].hitsInSegment =
1748 new TH1F(SpecName,
"Number of hits in a segment;nHits;entries",7,-0.5,6.5);
1754 sprintf(SpecName,
"AllSegments_eta_St%d",st+1);
1755 StHist[ec][st].AllSegments_eta =
1756 new TH1F(SpecName,
"All segments in eta;eta;entries",Chan,minChan,maxChan);
1758 sprintf(SpecName,
"EfficientSegments_eta_St%d",st+1);
1759 StHist[ec][st].EfficientSegments_eta =
1760 new TH1F(SpecName,
"Efficient segments in eta;eta;entries",Chan,minChan,maxChan);
1762 sprintf(SpecName,
"ResidualSegments_St%d",st+1);
1763 StHist[ec][st].ResidualSegments =
1764 new TH1F(SpecName,
"Residual (segments);residual,cm;entries",75,0.,15.);
1770 float minChan2 = -800.;
1771 float maxChan2 = 800.;
1773 sprintf(SpecName,
"EfficientSegments_XY_St%d",st+1);
1774 StHist[ec][st].EfficientSegments_XY =
new TH2F(SpecName,
"Efficient segments in XY;X;Y",
1775 Chan,minChan,maxChan,Chan2,minChan2,maxChan2);
1776 sprintf(SpecName,
"InefficientSegments_XY_St%d",st+1);
1777 StHist[ec][st].InefficientSegments_XY =
new TH2F(SpecName,
"Inefficient segments in XY;X;Y",
1778 Chan,minChan,maxChan,Chan2,minChan2,maxChan2);
1783 sprintf(SpecName,
"EfficientALCT_momTheta_St%d",st+1);
1784 StHist[ec][st].EfficientALCT_momTheta =
new TH1F(SpecName,
"Efficient ALCT in theta (momentum);theta, rad;entries",
1785 Chan,minChan,maxChan);
1787 sprintf(SpecName,
"InefficientALCT_momTheta_St%d",st+1);
1788 StHist[ec][st].InefficientALCT_momTheta =
new TH1F(SpecName,
"Inefficient ALCT in theta (momentum);theta, rad;entries",
1789 Chan,minChan,maxChan);
1794 sprintf(SpecName,
"EfficientCLCT_momPhi_St%d",st+1);
1795 StHist[ec][st].EfficientCLCT_momPhi =
new TH1F(SpecName,
"Efficient CLCT in phi (momentum);phi, rad;entries",
1796 Chan,minChan,maxChan);
1798 sprintf(SpecName,
"InefficientCLCT_momPhi_St%d",st+1);
1799 StHist[ec][st].InefficientCLCT_momPhi =
new TH1F(SpecName,
"Inefficient CLCT in phi (momentum);phi, rad;entries",
1800 Chan,minChan,maxChan);
1803 for(
int rg = 0;rg<3;++rg){
1807 else if(1==rg && 3==st){
1811 if(0!=st && 0==rg && iChamber >18){
1815 sprintf(SpecName,
"Chambers__E%d_S%d_R%d_Chamber_%d",ec+1, st+1, rg+1,iChamber);
1820 sprintf(SpecName,
"EfficientRechits_inSegment_Ch%d",iChamber);
1821 ChHist[ec][st][rg][iChamber-
FirstCh].EfficientRechits_inSegment =
1822 new TH1F(SpecName,
"Existing RecHit given a segment;layers (1-6);entries",nLayer_bins,Layer_min,Layer_max);
1824 sprintf(SpecName,
"InefficientSingleHits_Ch%d",iChamber);
1825 ChHist[ec][st][rg][iChamber-
FirstCh].InefficientSingleHits =
1826 new TH1F(SpecName,
"Single RecHits not in the segment;layers (1-6);entries ",nLayer_bins,Layer_min,Layer_max);
1828 sprintf(SpecName,
"AllSingleHits_Ch%d",iChamber);
1829 ChHist[ec][st][rg][iChamber-
FirstCh].AllSingleHits =
1830 new TH1F(SpecName,
"Single RecHits given a segment; layers (1-6);entries",nLayer_bins,Layer_min,Layer_max);
1832 sprintf(SpecName,
"digiAppearanceCount_Ch%d",iChamber);
1833 ChHist[ec][st][rg][iChamber-
FirstCh].digiAppearanceCount =
1834 new TH1F(SpecName,
"Digi appearance (no-yes): segment(0,1), ALCT(2,3), CLCT(4,5), CorrLCT(6,7); digi type;entries",
1840 sprintf(SpecName,
"EfficientALCT_dydz_Ch%d",iChamber);
1841 ChHist[ec][st][rg][iChamber-
FirstCh].EfficientALCT_dydz =
1842 new TH1F(SpecName,
"Efficient ALCT; local dy/dz (ME 3 and 4 flipped);entries",
1843 Chan, minChan, maxChan);
1845 sprintf(SpecName,
"InefficientALCT_dydz_Ch%d",iChamber);
1846 ChHist[ec][st][rg][iChamber-
FirstCh].InefficientALCT_dydz =
1847 new TH1F(SpecName,
"Inefficient ALCT; local dy/dz (ME 3 and 4 flipped);entries",
1848 Chan, minChan, maxChan);
1853 sprintf(SpecName,
"EfficientCLCT_dxdz_Ch%d",iChamber);
1854 ChHist[ec][st][rg][iChamber-
FirstCh].EfficientCLCT_dxdz =
1855 new TH1F(SpecName,
"Efficient CLCT; local dxdz;entries",
1856 Chan, minChan, maxChan);
1858 sprintf(SpecName,
"InefficientCLCT_dxdz_Ch%d",iChamber);
1859 ChHist[ec][st][rg][iChamber-
FirstCh].InefficientCLCT_dxdz =
1860 new TH1F(SpecName,
"Inefficient CLCT; local dxdz;entries",
1861 Chan, minChan, maxChan);
1863 sprintf(SpecName,
"EfficientRechits_good_Ch%d",iChamber);
1864 ChHist[ec][st][rg][iChamber-
FirstCh].EfficientRechits_good =
1865 new TH1F(SpecName,
"Existing RecHit - sensitive area only;layers (1-6);entries",nLayer_bins,Layer_min,Layer_max);
1867 sprintf(SpecName,
"EfficientStrips_Ch%d",iChamber);
1868 ChHist[ec][st][rg][iChamber-
FirstCh].EfficientStrips =
1869 new TH1F(SpecName,
"Existing strip;layer (1-6); entries",nLayer_bins,Layer_min,Layer_max);
1871 sprintf(SpecName,
"EfficientWireGroups_Ch%d",iChamber);
1872 ChHist[ec][st][rg][iChamber-
FirstCh].EfficientWireGroups =
1873 new TH1F(SpecName,
"Existing WireGroups;layer (1-6); entries ",nLayer_bins,Layer_min,Layer_max);
1875 sprintf(SpecName,
"StripWiresCorrelations_Ch%d",iChamber);
1876 ChHist[ec][st][rg][iChamber-
FirstCh].StripWiresCorrelations =
1877 new TH1F(SpecName,
"StripWire correlations;; entries ",5,0.5,5.5);
1882 sprintf(SpecName,
"NoWires_momTheta_Ch%d",iChamber);
1883 ChHist[ec][st][rg][iChamber-
FirstCh].NoWires_momTheta =
1884 new TH1F(SpecName,
"No wires (all strips present) - in theta (momentum);theta, rad;entries",
1885 Chan,minChan,maxChan);
1890 sprintf(SpecName,
"NoStrips_momPhi_Ch%d",iChamber);
1891 ChHist[ec][st][rg][iChamber-
FirstCh].NoStrips_momPhi =
1892 new TH1F(SpecName,
"No strips (all wires present) - in phi (momentum);phi, rad;entries",
1893 Chan,minChan,maxChan);
1895 for(
int iLayer=0; iLayer<6;iLayer++){
1896 sprintf(SpecName,
"Y_InefficientRecHits_inSegment_Ch%d_L%d",iChamber,iLayer);
1897 ChHist[ec][st][rg][iChamber-
FirstCh].Y_InefficientRecHits_inSegment.push_back
1898 (
new TH1F(SpecName,
"Missing RecHit/layer in a segment (local system, whole chamber);Y, cm; entries",
1899 nYbins,Ymin, Ymax));
1901 sprintf(SpecName,
"Y_EfficientRecHits_inSegment_Ch%d_L%d",iChamber,iLayer);
1902 ChHist[ec][st][rg][iChamber-
FirstCh].Y_EfficientRecHits_inSegment.push_back
1903 (
new TH1F(SpecName,
"Efficient (extrapolated from the segment) RecHit/layer in a segment (local system, whole chamber);Y, cm; entries",
1904 nYbins,Ymin, Ymax));
1909 sprintf(SpecName,
"Phi_InefficientRecHits_inSegment_Ch%d_L%d",iChamber,iLayer);
1910 ChHist[ec][st][rg][iChamber-
FirstCh].Phi_InefficientRecHits_inSegment.push_back
1911 (
new TH1F(SpecName,
"Missing RecHit/layer in a segment (local system, whole chamber);Phi, rad; entries",
1912 Chan, minChan, maxChan));
1914 sprintf(SpecName,
"Phi_EfficientRecHits_inSegment_Ch%d_L%d",iChamber,iLayer);
1915 ChHist[ec][st][rg][iChamber-
FirstCh].Phi_EfficientRecHits_inSegment.push_back
1916 (
new TH1F(SpecName,
"Efficient (extrapolated from the segment) in a segment (local system, whole chamber);Phi, rad; entries",
1917 Chan, minChan, maxChan));
1921 sprintf(SpecName,
"Sim_Rechits_Ch%d",iChamber);
1922 ChHist[ec][st][rg][iChamber-
FirstCh].SimRechits =
1923 new TH1F(SpecName,
"Existing RecHit (Sim);layers (1-6);entries",nLayer_bins,Layer_min,Layer_max);
1925 sprintf(SpecName,
"Sim_Simhits_Ch%d",iChamber);
1926 ChHist[ec][st][rg][iChamber-
FirstCh].SimSimhits =
1927 new TH1F(SpecName,
"Existing SimHit (Sim);layers (1-6);entries",nLayer_bins,Layer_min,Layer_max);
1947 if (theService)
delete theService;
1952 std::vector<float> bins, Efficiency, EffError;
1953 std::vector<float> eff(2);
1956 std::map <std::string, bool> chamberTypes;
1957 chamberTypes[
"ME11"] =
false;
1958 chamberTypes[
"ME12"] =
false;
1959 chamberTypes[
"ME13"] =
false;
1960 chamberTypes[
"ME21"] =
false;
1961 chamberTypes[
"ME22"] =
false;
1962 chamberTypes[
"ME31"] =
false;
1963 chamberTypes[
"ME32"] =
false;
1964 chamberTypes[
"ME41"] =
false;
1966 map<std::string,bool>::iterator iter;
1967 std::cout<<
" Writing proper histogram structure (patience)..."<<std::endl;
1968 for(
int ec = 0;ec<2;++ec){
1969 for(
int st = 0;st<4;++st){
1970 sprintf(SpecName,
"Stations__E%d_S%d",ec+1, st+1);
1972 StHist[ec][st].segmentChi2_ndf->Write();
1973 StHist[ec][st].hitsInSegment->Write();
1974 StHist[ec][st].AllSegments_eta->Write();
1975 StHist[ec][st].EfficientSegments_eta->Write();
1976 StHist[ec][st].ResidualSegments->Write();
1977 StHist[ec][st].EfficientSegments_XY->Write();
1978 StHist[ec][st].InefficientSegments_XY->Write();
1979 StHist[ec][st].EfficientALCT_momTheta->Write();
1980 StHist[ec][st].InefficientALCT_momTheta->Write();
1981 StHist[ec][st].EfficientCLCT_momPhi->Write();
1982 StHist[ec][st].InefficientCLCT_momPhi->Write();
1983 for(
int rg = 0;rg<3;++rg){
1987 else if(1==rg && 3==st){
1991 if(0!=st && 0==rg && iChamber >18){
1994 sprintf(SpecName,
"Chambers__E%d_S%d_R%d_Chamber_%d",ec+1, st+1, rg+1,iChamber);
1997 ChHist[ec][st][rg][iChamber-
FirstCh].EfficientRechits_inSegment->Write();
1998 ChHist[ec][st][rg][iChamber-
FirstCh].AllSingleHits->Write();
1999 ChHist[ec][st][rg][iChamber-
FirstCh].digiAppearanceCount->Write();
2000 ChHist[ec][st][rg][iChamber-
FirstCh].EfficientALCT_dydz->Write();
2001 ChHist[ec][st][rg][iChamber-
FirstCh].InefficientALCT_dydz->Write();
2002 ChHist[ec][st][rg][iChamber-
FirstCh].EfficientCLCT_dxdz->Write();
2003 ChHist[ec][st][rg][iChamber-
FirstCh].InefficientCLCT_dxdz->Write();
2004 ChHist[ec][st][rg][iChamber-
FirstCh].InefficientSingleHits->Write();
2005 ChHist[ec][st][rg][iChamber-
FirstCh].EfficientRechits_good->Write();
2006 ChHist[ec][st][rg][iChamber-
FirstCh].EfficientStrips->Write();
2007 ChHist[ec][st][rg][iChamber-
FirstCh].StripWiresCorrelations->Write();
2008 ChHist[ec][st][rg][iChamber-
FirstCh].NoWires_momTheta->Write();
2009 ChHist[ec][st][rg][iChamber-
FirstCh].NoStrips_momPhi->Write();
2010 ChHist[ec][st][rg][iChamber-
FirstCh].EfficientWireGroups->Write();
2011 for(
unsigned int iLayer = 0; iLayer< 6; iLayer++){
2012 ChHist[ec][st][rg][iChamber-
FirstCh].Y_InefficientRecHits_inSegment[iLayer]->Write();
2013 ChHist[ec][st][rg][iChamber-
FirstCh].Y_EfficientRecHits_inSegment[iLayer]->Write();
2014 ChHist[ec][st][rg][iChamber-
FirstCh].Phi_InefficientRecHits_inSegment[iLayer]->Write();
2015 ChHist[ec][st][rg][iChamber-
FirstCh].Phi_EfficientRecHits_inSegment[iLayer]->Write();
2017 ChHist[ec][st][rg][iChamber-
FirstCh].SimRechits->Write();
2018 ChHist[ec][st][rg][iChamber-
FirstCh].SimSimhits->Write();
2031 sprintf(SpecName,
"AllChambers");
2035 TriggersFired->Write();
2036 ALCTPerEvent->Write();
2037 CLCTPerEvent->Write();
2038 recHitsPerEvent->Write();
2039 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)
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
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)
virtual const std::vector< float > parameters() const
C::const_iterator const_iterator
constant access iterator type
double eta() const
pseudorapidity of momentum vector
FreeTrajectoryState * freeState(bool withErrors=true) const
double pt() const
track transverse momentum
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.
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
const CartesianTrajectoryError & cartesianError() const
bool recHitSegment_Efficiencies(CSCDetId &cscDetId, const CSCChamber *cscChamber, FreeTrajectoryState &ftsChamber)
std::vector< DigiType >::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
const PositionType & position() const
unsigned int innerDetId() const
DetId of the detector on which surface the innermost state is located.
float stripAngle(int strip) const
virtual const BoundPlane & surface() const
The nominal surface of the GeomDet.
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)