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.3 by konec, Mon Oct 1 19:20:38 2012 UTC

# Line 25 | Line 25 | void AnaDet::run(
25   {
26    typedef std::vector<uint32_t>::const_iterator IDET;
27    if( muon->pt() < 10.) return;
28 + //  if (fabs(muon->eta()) > 1.14 && fabs(muon->eta()) < 1.24) debug = true;
29  
30    DetEfficiencyManager aManDIS;
31    for( IDET it= detsHitsCompatibleWithMuon.begin(); it < detsHitsCompatibleWithMuon.end(); it++) aManDIS.addDetHit( *it );
# Line 58 | Line 59 | void AnaDet::run(
59    //
60    // coincidenciy efficiencies
61    //
62 <  std::bitset<6> hits;
63 <  std::bitset<6> dets;
62 >  std::bitset<6> hits, hitsL, hitsH;
63 >  std::bitset<6> dets, detsL, detsH;
64 >  double fetaL = fabs(muon->eta())-0.01;
65 >  double fetaH = fabs(muon->eta())+0.07;
66    for (std::vector<DetEfficiency>::const_iterator it = detEffic.begin(); it != detEffic.end(); ++it) {
67      if (debug) { std::cout <<it->print() << std::endl; }
68      if (it->isDummy()) continue;
69      RPCDetIdUtil det(it->detId());
70 <    if (it->numberOfHits() > 0) hits.set(det.layer()-1);
71 <    if (it->numberOfMuons() > 0) dets.set(det.layer()-1);
70 >
71 >    unsigned int dl = det.layer(muon->eta());
72 >    if (it->numberOfHits() > 0   && dl > 0) hits.set(dl-1);
73 >    if (it->numberOfMuons() > 0  && dl > 0) dets.set(dl-1);
74 >
75 >    unsigned int dlL = det.layer(fetaL);
76 >    if (it->numberOfHits() > 0   && dlL > 0) hitsL.set(dlL-1);
77 >    if (it->numberOfMuons() > 0  && dlL > 0) detsL.set(dlL-1);
78 >
79 >    unsigned int dlH = det.layer(fetaH);
80 >    if (it->numberOfHits() > 0   && dlH > 0) hitsH.set(dlH-1);
81 >    if (it->numberOfMuons() > 0  && dlH > 0) detsH.set(dlH-1);
82    }
83    if (debug) std::cout <<" Dets crossed by muons: "<<dets.to_string() << std::endl;
84    if (debug) std::cout <<" Hits letf    by muons: "<<hits.to_string() << std::endl;
85  
86 <  if  (fabs(muon->eta()) < 0.8) {
87 <    hDet_Muon->Fill(muon->eta());
88 <    bool matched_hits = false;
89 <    bool matched_dets = false;
90 <    typedef std::vector< std::bitset<6> >::const_iterator IT;
91 <    for (IT it= theLayers.begin(); it != theLayers.end(); ++it) if (it->to_ulong() == hits.to_ulong()) matched_hits = true;
92 <    for (IT it= theLayers.begin(); it != theLayers.end(); ++it) if (it->to_ulong() == dets.to_ulong()) matched_dets = true;
93 <    if (matched_hits) hDet_CoincHit->Fill(muon->eta());
94 <    if (matched_dets) hDet_CoincDet->Fill(muon->eta());
95 <    if (debug) std::cout<<"Coinc dets: "<<matched_dets<<"Coinc hits: "<<matched_hits<<std::endl;
96 < /*
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 < */
86 >  bool matched_hits =    theLayerCoincManager.matched( fetaL, hitsL)
87 >                      || theLayerCoincManager.matched( muon->eta(), hits )
88 >                      || theLayerCoincManager.matched( fetaH, hitsH);
89 >  bool matched_dets =    theLayerCoincManager.matched( fetaL, detsL)
90 >                      || theLayerCoincManager.matched( muon->eta(), dets )
91 >                      || theLayerCoincManager.matched( fetaH, detsH);
92 >
93 >  hDet_Muon->Fill(muon->eta());
94 >  if (matched_hits) hDet_CoincHit->Fill(muon->eta());
95 >  if (matched_dets) hDet_CoincDet->Fill(muon->eta());
96 >  if (debug) std::cout<<"Coinc dets: "<<matched_dets<<"Coinc hits: "<<matched_hits<<std::endl;
97      
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
98   }
99  
100   TGraph* AnaDet::resume()
# Line 122 | Line 117 | TGraph* AnaDet::resume()
117    return hDet_GraphEffic;
118   }
119  
120 < AnaDet::AnaDet(TObjArray& histos)
126 <  : debug(false)
120 > void AnaDet::init(TObjArray& histos)
121   {
122    hDet_EfficRoll = new TH1D("hDet_EfficRoll","hDet_EfficRoll",220,-0.05,1.05); histos.Add(hDet_EfficRoll);
123    hDet_EfficRollWeighted = new TH1D("hDet_EfficRollWeighted","hDet_EfficRollWeighted",220,-0.05,1.05); histos.Add(hDet_EfficRollWeighted);
# Line 144 | Line 138 | AnaDet::AnaDet(TObjArray& histos)
138        hDet_PartDet[i-1]->GetXaxis()->SetBinLabel(j+1, ax.str().c_str());
139      }  
140    }
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
141   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines