ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/L1RpcTriggerAnalysis/src/AnaDet.cc
(Generate patch)

Comparing UserCode/L1RpcTriggerAnalysis/src/AnaDet.cc (file contents):
Revision 1.1 by konec, Mon Nov 28 18:39:48 2011 UTC vs.
Revision 1.4 by konec, Tue Oct 23 20:17:44 2012 UTC

# Line 6 | Line 6
6   #include "TGraphErrors.h"
7   #include "UserCode/L1RpcTriggerAnalysis/interface/RPCDetIdUtil.h"
8   #include "UserCode/L1RpcTriggerAnalysis/interface/MuonObj.h"
9 + #include "UserCode/L1RpcTriggerAnalysis/interface/DetCluDigiObj.h"
10   #include <sstream>
11   #include <bitset>
12   #include <algorithm>
# Line 19 | Line 20 | namespace {
20  
21   void AnaDet::run(
22              const MuonObj* muon,
23 <            const std::vector<uint32_t> & detsHitsCompatibleWithMuon,
23 >            const std::vector<DetCluDigiObj> & detsHitsCompatibleWithMuon,
24              const std::vector<uint32_t> & detsCrossedByMuon,
25              const std::vector<uint32_t> & detsCrossedByMuonDeepInside)
26   {
27    typedef std::vector<uint32_t>::const_iterator IDET;
28 +  typedef std::vector<DetCluDigiObj>::const_iterator IDCD;
29    if( muon->pt() < 10.) return;
30 + //  if (fabs(muon->eta()) > 1.14 && fabs(muon->eta()) < 1.24) debug = true;
31  
32    DetEfficiencyManager aManDIS;
33 <  for( IDET it= detsHitsCompatibleWithMuon.begin(); it < detsHitsCompatibleWithMuon.end(); it++) aManDIS.addDetHit( *it );
33 >  for( IDCD it= detsHitsCompatibleWithMuon.begin(); it < detsHitsCompatibleWithMuon.end(); it++) aManDIS.addDetHit( it->det );
34    for( IDET it= detsCrossedByMuonDeepInside.begin(); it < detsCrossedByMuonDeepInside.end(); it++) aManDIS.addDetMuon( *it );
35    const std::vector<DetEfficiency> & detEfficDIS = aManDIS.dets();
36  
# Line 52 | Line 55 | void AnaDet::run(
55    //
56    DetEfficiencyManager aMan;
57    if (debug) std::cout <<"detsCrossedByMuon: "<<detsCrossedByMuon.size()<<" detsHitsCompatibleWithMuon: "<<detsHitsCompatibleWithMuon.size()<<std::endl;
58 <  for( IDET it= detsHitsCompatibleWithMuon.begin(); it < detsHitsCompatibleWithMuon.end(); it++) aMan.addDetHit( *it );
58 >  for( IDCD it= detsHitsCompatibleWithMuon.begin(); it < detsHitsCompatibleWithMuon.end(); it++) aMan.addDetHit( it->det );
59    for( IDET it= detsCrossedByMuon.begin(); it < detsCrossedByMuon.end(); it++) aMan.addDetMuon( *it );
60    const std::vector<DetEfficiency> & detEffic= aMan.dets();
61    //
62    // coincidenciy efficiencies
63    //
64 <  std::bitset<6> hits;
65 <  std::bitset<6> dets;
64 >  std::bitset<6> hits, hitsL, hitsH;
65 >  std::bitset<6> dets, detsL, detsH;
66 >  double fetaL = fabs(muon->eta())-0.01;
67 >  double fetaH = fabs(muon->eta())+0.07;
68    for (std::vector<DetEfficiency>::const_iterator it = detEffic.begin(); it != detEffic.end(); ++it) {
69      if (debug) { std::cout <<it->print() << std::endl; }
70      if (it->isDummy()) continue;
71      RPCDetIdUtil det(it->detId());
72 <    if (it->numberOfHits() > 0) hits.set(det.layer()-1);
73 <    if (it->numberOfMuons() > 0) dets.set(det.layer()-1);
72 >
73 >    unsigned int dl = det.layer(muon->eta());
74 >    if (it->numberOfHits() > 0   && dl > 0) hits.set(dl-1);
75 >    if (it->numberOfMuons() > 0  && dl > 0) dets.set(dl-1);
76 >
77 >    unsigned int dlL = det.layer(fetaL);
78 >    if (it->numberOfHits() > 0   && dlL > 0) hitsL.set(dlL-1);
79 >    if (it->numberOfMuons() > 0  && dlL > 0) detsL.set(dlL-1);
80 >
81 >    unsigned int dlH = det.layer(fetaH);
82 >    if (it->numberOfHits() > 0   && dlH > 0) hitsH.set(dlH-1);
83 >    if (it->numberOfMuons() > 0  && dlH > 0) detsH.set(dlH-1);
84    }
85    if (debug) std::cout <<" Dets crossed by muons: "<<dets.to_string() << std::endl;
86    if (debug) std::cout <<" Hits letf    by muons: "<<hits.to_string() << std::endl;
87  
88 <  if  (fabs(muon->eta()) < 0.8) {
89 <    hDet_Muon->Fill(muon->eta());
90 <    bool matched_hits = false;
91 <    bool matched_dets = false;
92 <    typedef std::vector< std::bitset<6> >::const_iterator IT;
93 <    for (IT it= theLayers.begin(); it != theLayers.end(); ++it) if (it->to_ulong() == hits.to_ulong()) matched_hits = true;
94 <    for (IT it= theLayers.begin(); it != theLayers.end(); ++it) if (it->to_ulong() == dets.to_ulong()) matched_dets = true;
95 <    if (matched_hits) hDet_CoincHit->Fill(muon->eta());
96 <    if (matched_dets) hDet_CoincDet->Fill(muon->eta());
97 <    if (debug) std::cout<<"Coinc dets: "<<matched_dets<<"Coinc hits: "<<matched_hits<<std::endl;
98 < /*
84 <    int nhits = 0; for(unsigned int i=0; i<6; i++) if (hits[i]) nhits++;
85 <    int ndets= 0; for(unsigned int i=0; i<6; i++) if (dets[i]) ndets++;
86 <    if (nhits>=3 &&
87 <       (    ( (hits[0]||hits[1]) + (hits[2]||hits[3]) == 2 )
88 <         || ( (hits[0]||hits[1]) + (hits[2]||hits[3]) + hits[4] + hits[5] >=3 ) ) ) hDet_CoincHit->Fill(muon->eta());
89 <    if (ndets>=3 &&
90 <       (    ( (dets[0]||dets[1]) + (dets[2]||dets[3]) == 2 )
91 <         || ( (dets[0]||dets[1]) + (dets[2]||dets[3]) + dets[4] + dets[5] >=3 ) ) ) hDet_CoincDet->Fill(muon->eta());
92 <    if (!hits[0] && !hits[1] && hits[2] && hits[3] && !hits[4] &&hits[5]) debug=true;
93 < */
88 >  bool matched_hits =    theLayerCoincManager.matched( fetaL, hitsL)
89 >                      || theLayerCoincManager.matched( muon->eta(), hits )
90 >                      || theLayerCoincManager.matched( fetaH, hitsH);
91 >  bool matched_dets =    theLayerCoincManager.matched( fetaL, detsL)
92 >                      || theLayerCoincManager.matched( muon->eta(), dets )
93 >                      || theLayerCoincManager.matched( fetaH, detsH);
94 >
95 >  hDet_Muon->Fill(muon->eta());
96 >  if (matched_hits) hDet_CoincHit->Fill(muon->eta());
97 >  if (matched_dets) hDet_CoincDet->Fill(muon->eta());
98 >  if (debug) std::cout<<"Coinc dets: "<<matched_dets<<"Coinc hits: "<<matched_hits<<std::endl;
99      
95  } else if (fabs(muon->eta()) > 1.25 && fabs(muon->eta()) < 1.6) {
96    hDet_Muon->Fill(muon->eta());
97 //    int nhits = 0; for(unsigned int i=0; i<3; i++) if (hits[i]) nhits++;
98 //    int ndets= 0; for(unsigned int i=0; i<3; i++) if (dets[i]) ndets++;
99    if (hits.count() >= 3) hDet_CoincHit->Fill(muon->eta());
100    if (dets.count() >= 3) hDet_CoincDet->Fill(muon->eta());
101  }
102
100   }
101  
102   TGraph* AnaDet::resume()
# Line 122 | Line 119 | TGraph* AnaDet::resume()
119    return hDet_GraphEffic;
120   }
121  
122 < AnaDet::AnaDet(TObjArray& histos)
126 <  : debug(false)
122 > void AnaDet::init(TObjArray& histos)
123   {
124    hDet_EfficRoll = new TH1D("hDet_EfficRoll","hDet_EfficRoll",220,-0.05,1.05); histos.Add(hDet_EfficRoll);
125    hDet_EfficRollWeighted = new TH1D("hDet_EfficRollWeighted","hDet_EfficRollWeighted",220,-0.05,1.05); histos.Add(hDet_EfficRollWeighted);
# Line 144 | Line 140 | AnaDet::AnaDet(TObjArray& histos)
140        hDet_PartDet[i-1]->GetXaxis()->SetBinLabel(j+1, ax.str().c_str());
141      }  
142    }
147 /*
148
149
150  for (unsigned int i=1; i<=6; ++i) {
151    std::stringstream name;
152    name.str(""); name<<"hDet_Det_N"<< i; hEfficDetB_N[i-1]= new TH1D( name.str().c_str(), name.str().c_str(), 64, -1.6, 1.6);  histos.Add( hEfficDetB_N[i-1]);
153    name.str(""); name<<"hDet_HitB_N"<< i; hEfficHitB_N[i-1]= new TH1D( name.str().c_str(), name.str().c_str(), 64, -1.6, 1.6);  histos.Add( hEfficHitB_N[i-1]);
154    }
155  }
156
157  TH1D * hHitsB = new TH1D("hHitsB","Layers with RPC hits matching propagated muon - Barrel;No of layers;Muons",7,-0.5,6.5);  histos.Add(hHitsB);
158  TH1D * hHitsE = new TH1D("hHitsE","Layers with RPC hits matching propagated muon - Endcap;No of layers;Muons",4,-0.5,3.5);  histos.Add(hHitsE);
159  TH1D * hDet_sB_100 = new TH1D("hDet_sB_100","Layers with RPCs crossed by propagated muon - Barrel;No of layers;Muons",7,-0.5,6.5);  histos.Add(hDet_sB_100);
160  TH1D * hDet_sE_100 = new TH1D("hDet_sE_100","Layers with RPCs crossed by propagated muon - Endcap;No of layers;Muons",4,-0.5,3.5);  histos.Add(hDet_sE_100);
161
162  // efficiency for hits
163  // barrel |eta|<0,8, endcap 1.25<|eta|<1.55
164  TH1D * hEfficGeom_M = new TH1D("hEfficGeom_M","Propaged muons matching RPC Geom;Glb.muon #eta;Muons /bin", 64, -1.6, 1.6);  histos.Add(hEfficGeom_M);
165  TH1D * hEfficGeom_H = new TH1D("hEfficGeom_H","Propaged muons matching RPC Geom;Glb.muon #eta;Muons / bin", 64, -1.6, 1.6);  histos.Add(hEfficGeom_H);
166  TH1D * hEfficGeom_D = new TH1D("hEfficGeom_D","RPC triggers;Glb.muon #eta;Muons / bin",64, -1.6, 1.6);  histos.Add(hEfficGeom_D);
167  TH1D * hEfficGeom_T = new TH1D("hEfficGeom_T","Propaged muons crossing RPCs;Glb.muon #eta;Muons / bin",64, -1.6, 1.6);  histos.Add(hEfficGeom_T);
168
169  TH1D * hEfficGeom_H_3z6 = new TH1D("hEfficGeom_H_3z6","Propaged muons matching RPC Geom;Glb.muon #eta;Muons / bin", 64, -1.6, 1.6);  histos.Add(hEfficGeom_H_3z6);
170  TH1D * hEfficGeom_D_3z6 = new TH1D("hEfficGeom_D_3z6","RPC triggers;Glb.muon #eta;Muons / bin",64, -1.6, 1.6);  histos.Add(hEfficGeom_D_3z6);
171  TH1D * hEfficGeom_T_3z6 = new TH1D("hEfficGeom_T_3z6","Propaged muons crossing RPCs;Glb.muon #eta;Muons / bin",64, -1.6, 1.6);  histos.Add(hEfficGeom_T_3z6);
172
173  //without affected stations
174
175  TH1D * hEfficGeom_M_good = new TH1D("hEfficGeom_M_good","Propaged muons matching RPC Geom;Glb.muon #eta;Muons /bin", 64, -1.6, 1.6);  histos.Add(hEfficGeom_M_good);
176  TH1D * hEfficGeom_H_good = new TH1D("hEfficGeom_H_good","Propaged muons matching RPC Geom;Glb.muon #eta;Muons / bin", 64, -1.6, 1.6);  histos.Add(hEfficGeom_H_good);
177  TH1D * hEfficGeom_D_good = new TH1D("hEfficGeom_D_good","RPC triggers;Glb.muon #eta;Muons / bin",64, -1.6, 1.6);  histos.Add(hEfficGeom_D_good);
178  TH1D * hEfficGeom_T_good = new TH1D("hEfficGeom_T_good","Propaged muons crossing RPCs;Glb.muon #eta;Muons / bin",64, -1.6, 1.6);  histos.Add(hEfficGeom_T_good);
179
180  TH1D * hEfficGeom_H_3z6_good = new TH1D("hEfficGeom_H_3z6_good","Propaged muons matching RPC Geom;Glb.muon #eta;Muons / bin", 64, -1.6, 1.6);  histos.Add(hEfficGeom_H_3z6_good);
181  TH1D * hEfficGeom_D_3z6_good = new TH1D("hEfficGeom_D_3z6_good","RPC triggers;Glb.muon #eta;Muons / bin",64, -1.6, 1.6);  histos.Add(hEfficGeom_D_3z6_good);
182  TH1D * hEfficGeom_T_3z6_good = new TH1D("hEfficGeom_T_3z6_good","Propaged muons crossing RPCs;Glb.muon #eta;Muons / bin",64, -1.6, 1.6);  histos.Add(hEfficGeom_T_3z6_good);
183
184
185 // efficiency for hits
186  // full region
187  TH1D * hEfficGeomTot_M = new TH1D("hEfficGeomTot_M","Propaged muons matching RPC Geom;Glb.muon #eta;Muons /bin", 128, -1.6, 1.6);  histos.Add(hEfficGeomTot_M);
188  TH1D * hEfficGeomTot_H = new TH1D("hEfficGeomTot_H","Propaged muons matching RPC Geom;Glb.muon #eta;Muons / bin", 128, -1.6, 1.6);  histos.Add(hEfficGeomTot_H);
189  TH1D * hEfficGeomTot_D = new TH1D("hEfficGeomTot_D","RPC triggers;Glb.muon #eta;Muons / bin",128, -1.6, 1.6);  histos.Add(hEfficGeomTot_D);
190  TH1D * hEfficGeomTot_T = new TH1D("hEfficGeomTot_T","Propaged muons crossing RPCs;Glb.muon #eta;Muons / bin",128, -1.6, 1.6);  histos.Add(hEfficGeomTot_T);
191
192
193  // in order to get numbewr of crossed layers
194  TH1D * hEfficChambBar_N = new TH1D("hEfficChambBar_N","Propaged muons matching RPC hits - Barrel;Layer;Muons",6,0.5,6.5); histos.Add(hEfficChambBar_N);
195  TH1D * hEfficChambBar_D = new TH1D("hEfficChambBar_D","Propaged muons crossing RPCs - Barrel;Layer;Muons",6,0.5,6.5); histos.Add(hEfficChambBar_D);
196  TH1D * hEfficChambEnd_N = new TH1D("hEfficChambEnd_N","Propaged muons matching RPC hits - Endcap;Layer;Muons",3,0.5,3.5); histos.Add(hEfficChambEnd_N);
197  TH1D * hEfficChambEnd_D = new TH1D("hEfficChambEnd_D","Propaged muons crossing RPCs - Endcap;Layer;Muons",3,0.5,3.5); histos.Add(hEfficChambEnd_D);
198
199  // efficiency for trigger wrt Mu
200  TH1D * hEfficMu_N =  new TH1D("hEfficMu_N","hEfficMu_N",64, -1.6, 1.6);  histos.Add(hEfficMu_N);
201  TH1D * hEfficMu_D =  new TH1D("hEfficMu_D","hEfficMu_D",64, -1.6, 1.6);  histos.Add(hEfficMu_D);
202 */
203
204  //
205  // initialise layers combinations in the barrel (from LUT).
206  //
207    theLayers.push_back(std::bitset<6>(std::string("011110")));
208    theLayers.push_back(std::bitset<6>(std::string("101110")));
209    theLayers.push_back(std::bitset<6>(std::string("110110")));
210    theLayers.push_back(std::bitset<6>(std::string("111010")));
211    theLayers.push_back(std::bitset<6>(std::string("111100")));
212    theLayers.push_back(std::bitset<6>(std::string("001111")));
213    theLayers.push_back(std::bitset<6>(std::string("010111")));
214    theLayers.push_back(std::bitset<6>(std::string("100111")));
215    theLayers.push_back(std::bitset<6>(std::string("011011")));
216    theLayers.push_back(std::bitset<6>(std::string("101011")));
217    theLayers.push_back(std::bitset<6>(std::string("110011")));
218    theLayers.push_back(std::bitset<6>(std::string("011101")));
219    theLayers.push_back(std::bitset<6>(std::string("101101")));
220    theLayers.push_back(std::bitset<6>(std::string("110101")));
221    theLayers.push_back(std::bitset<6>(std::string("111001")));
222    theLayers.push_back(std::bitset<6>(std::string("011111")));
223    theLayers.push_back(std::bitset<6>(std::string("101111")));
224    theLayers.push_back(std::bitset<6>(std::string("110111")));
225    theLayers.push_back(std::bitset<6>(std::string("111011")));
226    theLayers.push_back(std::bitset<6>(std::string("111101")));
227    theLayers.push_back(std::bitset<6>(std::string("111110")));
228    theLayers.push_back(std::bitset<6>(std::string("111111")));
229    theLayers.push_back(std::bitset<6>(std::string("111000")));
230    theLayers.push_back(std::bitset<6>(std::string("110100")));
231    theLayers.push_back(std::bitset<6>(std::string("110010")));
232    theLayers.push_back(std::bitset<6>(std::string("110001")));
233    theLayers.push_back(std::bitset<6>(std::string("100101")));
234    theLayers.push_back(std::bitset<6>(std::string("101001")));
235    theLayers.push_back(std::bitset<6>(std::string("101010")));
236    theLayers.push_back(std::bitset<6>(std::string("101100")));
237    theLayers.push_back(std::bitset<6>(std::string("010101")));
238    theLayers.push_back(std::bitset<6>(std::string("011001")));
239    theLayers.push_back(std::bitset<6>(std::string("011010")));
240    theLayers.push_back(std::bitset<6>(std::string("011100")));
241    theLayers.push_back(std::bitset<6>(std::string("000111")));
242    theLayers.push_back(std::bitset<6>(std::string("001011")));
243    theLayers.push_back(std::bitset<6>(std::string("001101")));
244    theLayers.push_back(std::bitset<6>(std::string("001110")));
245
143   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines