ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/Muon.h
(Generate patch)

Comparing UserCode/MitAna/DataTree/interface/Muon.h (file contents):
Revision 1.14 by loizides, Wed Sep 10 03:33:27 2008 UTC vs.
Revision 1.19 by ceballos, Fri Nov 28 18:05:53 2008 UTC

# Line 3 | Line 3
3   //
4   // Muon
5   //
6 < // Details to be worked out...
6 > // Details to be worked out... TODO by Phil
7   //
8 < // Authors: C.Loizides, J.Bendavid, C.Paus
8 > // Authors: J.Bendavid, C.Loizides, C.Paus, P.Harris
9   //--------------------------------------------------------------------------------------------------
10  
11   #ifndef MITANA_DATATREE_MUON_H
12   #define MITANA_DATATREE_MUON_H
13  
14   #include <TRef.h>
15 #include "MitAna/DataTree/interface/ChargedParticle.h"
15   #include "MitAna/DataTree/interface/Track.h"
16 + #include "MitAna/DataTree/interface/ChargedParticle.h"
17  
18 < namespace mithep
19 < {
20 <  class Muon : public ChargedParticle
21 <  {
18 > namespace mithep {
19 >  class Muon : public ChargedParticle {
20      public:
21        Muon() {}
22        ~Muon() {}
23 +
24 +      enum EClassType {
25 +        kNone,              //no track assigned
26 +        kGlobal,            //"Global"
27 +        kTrackerOnly,       //"TrackerOnly"
28 +        kSta,               //"Standalone"
29 +        kAny                //any "best" of the above
30 +      };
31        
32 <      const Track   *BestTrk()            const;
33 <      const Track   *GlobalTrk()          const;
34 <      const Track   *StandaloneTrk()      const;
35 <      const Track   *TrackerTrk()         const;
36 <      const Track   *Trk()                const { return BestTrk();          }
37 <      Double_t       IsoR03SumPt()        const { return fIsoR03SumPt;       }
38 <      Double_t       IsoR03EmEt()         const { return fIsoR03EmEt;        }
39 <      Double_t       IsoR03HadEt()        const { return fIsoR03HadEt;       }
40 <      Double_t       IsoR03HoEt()         const { return fIsoR03HoEt;        }
41 <      Int_t          IsoR03NTracks()      const { return fIsoR03NTracks;     }
42 <      Int_t          IsoR03NJets()        const { return fIsoR03NJets;       }
43 <      Double_t       IsoR05SumPt()        const { return fIsoR05SumPt;       }
44 <      Double_t       IsoR05EmEt()         const { return fIsoR05EmEt;        }
45 <      Double_t       IsoR05HadEt()        const { return fIsoR05HadEt;       }
46 <      Double_t       IsoR05HoEt()         const { return fIsoR05HoEt;        }
47 <      Int_t          IsoR05NTracks()      const { return fIsoR05NTracks;     }
48 <      Int_t          IsoR05NJets()        const { return fIsoR05NJets;       }            
49 <      Double_t       EmEnergy()           const { return fEmEnergy;          }
50 <      Double_t       HadEnergy()          const { return fHadEnergy;         }
51 <      Double_t       HoEnergy()           const { return fHoEnergy;          }
52 <      Double_t       EmS9Energy()         const { return fEmS9Energy;        }
53 <      Double_t       HadS9Energy()        const { return fHadS9Energy;       }
54 <      Double_t       HoS9Energy()         const { return fHoS9Energy;        }
55 <      Double_t       Mass()               const { return 105.658369e-3;      }  
56 <      
32 >      const Track   *BestTrk()             const;
33 >      const Track   *GlobalTrk()           const;
34 >      const Track   *StandaloneTrk()       const;
35 >      const Track   *TrackerTrk()          const;
36 >      const Track   *Trk()                 const { return BestTrk();          }
37 >      Double_t       IsoR03SumPt()         const { return fIsoR03SumPt;       }
38 >      Double_t       IsoR03EmEt()          const { return fIsoR03EmEt;        }
39 >      Double_t       IsoR03HadEt()         const { return fIsoR03HadEt;       }
40 >      Double_t       IsoR03HoEt()          const { return fIsoR03HoEt;        }
41 >      Int_t          IsoR03NTracks()       const { return fIsoR03NTracks;     }
42 >      Int_t          IsoR03NJets()         const { return fIsoR03NJets;       }
43 >      Double_t       IsoR05SumPt()         const { return fIsoR05SumPt;       }
44 >      Double_t       IsoR05EmEt()          const { return fIsoR05EmEt;        }
45 >      Double_t       IsoR05HadEt()         const { return fIsoR05HadEt;       }
46 >      Double_t       IsoR05HoEt()          const { return fIsoR05HoEt;        }
47 >      Int_t          IsoR05NTracks()       const { return fIsoR05NTracks;     }
48 >      Int_t          IsoR05NJets()         const { return fIsoR05NJets;       }            
49 >      Double_t       EmEnergy()            const { return fEmEnergy;          }
50 >      Double_t       HadEnergy()           const { return fHadEnergy;         }
51 >      Double_t       HoEnergy()            const { return fHoEnergy;          }
52 >      Double_t       EmS9Energy()          const { return fEmS9Energy;        }
53 >      Double_t       HadS9Energy()         const { return fHadS9Energy;       }
54 >      Double_t       HoS9Energy()          const { return fHoS9Energy;        }
55 >      Double_t       Mass()                const { return 105.658369e-3;             }  
56 >      Int_t          NChambers()           const { return fNTraversedChambers;       }
57 >      Int_t          NSegments()           const { return fStationMask.NBitsSet();   }
58 >      Bool_t         StationBit(Int_t bit) const { return fStationMask.TestBit(bit); }
59 >      Double_t       GetDX(Int_t iStation)             const;
60 >      Double_t       GetDY(Int_t iStation)             const;
61 >      Double_t       GetPullX(Int_t iStation)          const;
62 >      Double_t       GetPullY(Int_t iStation)          const;
63 >      Double_t       GetTrackDist(Int_t iStation)      const;
64 >      Double_t       GetTrackDistErr(Int_t iStation)   const;
65 >      Int_t          GetNSegments(Int_t iStation)      const;
66 >      Bool_t         Has(EClassType type)              const;
67 >      EClassType     Is()                              const;
68 >      Int_t          LastHit()                         const;
69 >      Int_t          LastStation(Double_t iMaxD, Double_t iMaxP)               const;
70 >      Int_t          LastStation(Int_t iMax=8)                                 const;
71 >      Bool_t         PromptTight(EClassType type)                              const;
72 >      Bool_t         TMLastStation(Double_t iDYMin = 3., Double_t iPYMin = 3.,
73 >                                   Double_t iDXMin = 3., Double_t iPXMin = 3.,Int_t iN = 2) const;
74 >      Bool_t         TMOneStation(Double_t iDYMin = 3., Double_t iPYMin = 3.,
75 >                                  Double_t iDXMin = 3., Double_t iPXMin = 3.,Int_t iN = 1)  const;
76        void           SetGlobalTrk(Track* t)                { fGlobalTrackRef = t;            }
77        void           SetStandaloneTrk(Track* t)            { fStandaloneTrackRef = t;        }
78        void           SetTrackerTrk(Track* t)               { fTrackerTrackRef = t;           }
# Line 69 | Line 94 | namespace mithep
94        void           SetEmS9Energy(Double_t EmS9Energy)    { fEmS9Energy = EmS9Energy;       }
95        void           SetHadS9Energy(Double_t HadS9Energy)  { fHadS9Energy = HadS9Energy;     }
96        void           SetHoS9Energy(Double_t HoS9Energy)    { fHoS9Energy = HoS9Energy;       }
97 +      void           SetNChambers(Int_t iNTraCh)           { fNTraversedChambers = iNTraCh;  }
98 +      void           SetStationMask(UInt_t iStMask)        { fStationMask.SetBits(iStMask);  }
99 +      void           SetDX(Int_t iStation, Double_t iDX);
100 +      void           SetDY(Int_t iStation, Double_t iDY);
101 +      void           SetPullX(Int_t iStation, Double_t iPullX);
102 +      void           SetPullY(Int_t iStation, Double_t iPullY);
103 +      void           SetTrackDist(Int_t iStation, Double_t iDist);
104 +      void           SetTrackDistErr(Int_t iStation, Double_t iDistErr);
105 +      void           SetNSegments(Int_t iStation, Int_t NSegments);
106  
107      protected:
108        TRef           fGlobalTrackRef;      //global combined track reference
109        TRef           fStandaloneTrackRef;  //standalone muon track reference
110        TRef           fTrackerTrackRef;     //tracker track reference
111 <      Double_t       fIsoR03SumPt;
112 <      Double_t       fIsoR03EmEt;
113 <      Double_t       fIsoR03HadEt;
114 <      Double_t       fIsoR03HoEt;
115 <      Int_t          fIsoR03NTracks;
116 <      Int_t          fIsoR03NJets;
117 <      Double_t       fIsoR05SumPt;
118 <      Double_t       fIsoR05EmEt;
119 <      Double_t       fIsoR05HadEt;
120 <      Double_t       fIsoR05HoEt;
121 <      Int_t          fIsoR05NTracks;
122 <      Int_t          fIsoR05NJets;      
123 <      Double_t       fEmEnergy;
124 <      Double_t       fHadEnergy;
125 <      Double_t       fHoEnergy;
126 <      Double_t       fEmS9Energy;
127 <      Double_t       fHadS9Energy;
128 <      Double_t       fHoS9Energy;
111 >      Double32_t     fIsoR03SumPt;         //isolation size R=0.3 sum pt
112 >      Double32_t     fIsoR03EmEt;          //isolation size R=0.3 em  trans energy
113 >      Double32_t     fIsoR03HadEt;         //isolation size R=0.3 had trans energy
114 >      Double32_t     fIsoR03HoEt;          //isolation size R=0.3 ho  trans energy
115 >      Int_t          fIsoR03NTracks;       //isolation size R=0.3 number of tracks
116 >      Int_t          fIsoR03NJets;         //isolation size R=0.3 number of jets
117 >      Double32_t     fIsoR05SumPt;         //isolation size R=0.5 sum pt
118 >      Double32_t     fIsoR05EmEt;          //isolation size R=0.5 em  trans energy
119 >      Double32_t     fIsoR05HadEt;         //isolation size R=0.5 had trans energy
120 >      Double32_t     fIsoR05HoEt;          //isolation size R=0.5 ho  trans energy
121 >      Int_t          fIsoR05NTracks;       //isolation size R=0.5 number of tracks
122 >      Int_t          fIsoR05NJets;         //isolation size R=0.5 number of jets      
123 >      Double32_t     fEmEnergy;            //energy deposit in ecal
124 >      Double32_t     fHadEnergy;           //energy deposit in hcal
125 >      Double32_t     fHoEnergy;            //energy deposit in outer hcal
126 >      Double32_t     fEmS9Energy;          //?
127 >      Double32_t     fHadS9Energy;         //?
128 >      Double32_t     fHoS9Energy;          //?
129 >      Int_t          fNTraversedChambers;  //number of tranversed chambers
130 >      BitMask8       fStationMask;         //bitmap of station with tracks, 0-3 DT, 4-7 CSCs
131 >      Double32_t     fDX[8];               //uncertainty in x in given muon chamber
132 >      Double32_t     fDY[8];               //uncertainty in y in given muon chamber
133 >      Double32_t     fPullX[8];            //pull in x in given muon chamber
134 >      Double32_t     fPullY[8];            //pull in y in given muon chamber
135 >      Double32_t     fTrackDist[8];        //dist. to track in trans. plane in given muon chamber
136 >      Double32_t     fTrackDistErr[8];     //error of dist. to track in trans. plane in chamber
137 >      Int_t          fNSegments[8];        //number of segments in given muon chamber
138  
139      ClassDef(Muon, 1) // Muon class
140    };
# Line 104 | Line 147 | inline const mithep::Track *mithep::Muon
147  
148    if (GlobalTrk())
149      return GlobalTrk();
107  else if (StandaloneTrk())
108    return StandaloneTrk();
150    else if (TrackerTrk())
151      return TrackerTrk();
152 +  else if (StandaloneTrk())
153 +    return StandaloneTrk();
154  
155    return 0;
156   }
# Line 135 | Line 178 | inline const mithep::Track *mithep::Muon
178  
179    return static_cast<const Track*>(fTrackerTrackRef.GetObject());
180   }
181 +
182 + //--------------------------------------------------------------------------------------------------
183 + inline Double_t mithep::Muon::GetDX(Int_t iStation) const
184 + {
185 +  // Return uncertainty in x in given chamber.
186 +
187 +  assert(iStation >= 0 && iStation < 8);
188 +  return fDX[iStation];
189 + }
190 +
191 + //--------------------------------------------------------------------------------------------------
192 + inline Double_t mithep::Muon::GetDY(Int_t iStation) const
193 + {
194 +  // Return uncertainty in y in given chamber.
195 +
196 +  assert(iStation >= 0 && iStation < 8);
197 +  return fDY[iStation];
198 + }
199 +
200 + //--------------------------------------------------------------------------------------------------
201 + inline Double_t mithep::Muon::GetPullX(Int_t iStation) const
202 + {
203 +  // Return pull in x in given chamber.
204 +
205 +  assert(iStation >= 0 && iStation < 8);
206 +  return fPullX[iStation];
207 + }
208 +
209 + //--------------------------------------------------------------------------------------------------
210 + inline Double_t mithep::Muon::GetPullY(Int_t iStation) const
211 + {
212 +  // Return pull in y in given chamber.
213 +  
214 +  assert(iStation >= 0 && iStation < 8);
215 +  return fPullY[iStation];
216 + }
217 +
218 + //--------------------------------------------------------------------------------------------------
219 + inline Double_t mithep::Muon::GetTrackDist(Int_t iStation) const
220 + {
221 +  // Return track distance in given chamber.
222 +
223 +  assert(iStation >= 0 && iStation < 8);
224 +  return fTrackDist[iStation];
225 + }
226 +
227 + //--------------------------------------------------------------------------------------------------
228 + inline Double_t mithep::Muon::GetTrackDistErr(Int_t iStation) const
229 + {
230 +  // Return error of track distance in given chamber.
231 +
232 +  assert(iStation >= 0 && iStation < 8);
233 +  return fTrackDistErr[iStation];
234 + }
235 +
236 + //--------------------------------------------------------------------------------------------------
237 + inline Int_t mithep::Muon::GetNSegments(Int_t iStation) const
238 + {
239 +  // Return number of segments in chamber.
240 +
241 +  assert(iStation >= 0 && iStation < 8);
242 +  return fNSegments[iStation];
243 + }
244 +
245 + //--------------------------------------------------------------------------------------------------
246 + inline Bool_t mithep::Muon::Has(EClassType type) const
247 + {
248 +  // Return true if the muon has a track of given class.
249 +
250 +  switch (type) {
251 +    case kAny:
252 +      if (BestTrk())
253 +        return kTRUE;
254 +      break;
255 +    case kGlobal:
256 +      if (GlobalTrk())
257 +        return kTRUE;
258 +      break;
259 +    case kTrackerOnly:
260 +      if (TrackerTrk())
261 +        return kTRUE;
262 +      break;
263 +    case kSta:
264 +      if (StandaloneTrk())
265 +        return kTRUE;
266 +      break;
267 +    case kNone:
268 +      if (!BestTrk())
269 +        return kTRUE;
270 +      break;
271 +    default:
272 +      break;
273 +  }
274 +
275 +  return kFALSE;
276 + }
277 +
278 + //--------------------------------------------------------------------------------------------------
279 + inline mithep::Muon::EClassType mithep::Muon::Is() const
280 + {
281 +  // Return the "best" classification of the muon according to the assigned tracks.
282 +
283 +  if (GlobalTrk())
284 +    return kGlobal;
285 +  else if (TrackerTrk())
286 +    return kTrackerOnly;
287 +  else if (StandaloneTrk())
288 +    return kSta;
289 +
290 +  return kNone;
291 + }
292 +
293 + //--------------------------------------------------------------------------------------------------
294 + inline Int_t mithep::Muon::LastHit() const
295 + {
296 +  // Return the last hit, or -1 if no one found.
297 +
298 +  Int_t lId = -1;
299 +  for (Int_t i0 = 0; i0 < 8; ++i0) {
300 +    if (GetDX(i0) < 99999 || GetDY(i0) < 99999)
301 +      lId = i0;
302 +  }
303 +  return lId;
304 + }
305 +
306 + //--------------------------------------------------------------------------------------------------
307 + inline Int_t mithep::Muon::LastStation(Int_t iMax) const
308 + {
309 +  // Return the last station, or -1 of no one found.
310 +
311 +  Int_t lId = -1;
312 +  if(TMath::Abs(iMax) > 8)
313 +    iMax = 8;
314 +  for (Int_t i0 = 0; i0 < iMax; ++i0) {
315 +    if (StationBit(i0) && ((lId % 4) < (i0 % 4)))
316 +      lId = i0;
317 +  }
318 +  return lId;
319 + }
320 +
321 + //--------------------------------------------------------------------------------------------------
322 + inline Int_t mithep::Muon::LastStation(Double_t iMaxD, Double_t iMaxP) const
323 + {
324 +  // Return the last station for given deviation and relative error, or -1 if no one found.
325 +
326 +  Int_t lId = -1;
327 +  for (Int_t i0 = 0; i0 < 8; ++i0) {
328 +    if ((lId % 4) > (i0 % 4))
329 +      continue;
330 +    if (GetTrackDist(i0) < iMaxD &&
331 +        GetTrackDist(i0)/GetTrackDistErr(i0) < iMaxP)
332 +      lId = i0;
333 +  }
334 +  return lId;
335 + }
336 +
337 + //--------------------------------------------------------------------------------------------------
338 + inline Bool_t mithep::Muon::PromptTight(EClassType type) const
339 + {
340 +  // Return whether track for given class matches tight quality criteria.
341 +
342 +  const mithep::Track *lTrack = 0;
343 +  switch (type) {
344 +    case kAny:
345 +      lTrack = BestTrk();
346 +      break;
347 +    case kGlobal:
348 +      lTrack = GlobalTrk();
349 +      break;
350 +    case kTrackerOnly:
351 +      lTrack = TrackerTrk();
352 +      break;
353 +    case kSta:
354 +      lTrack = StandaloneTrk();
355 +      break;
356 +    default:
357 +      break;
358 +  }
359 +
360 +  if (lTrack == 0)
361 +    return kFALSE;
362 +  if (lTrack->NHits() < 11)        
363 +    return kFALSE;
364 +  if (lTrack->Chi2()/lTrack->Ndof() > 10.)                        
365 +    return kFALSE;
366 +  if (lTrack->D0() > 0.2)                                          
367 +    return kFALSE;
368 +  if ((LastHit() % 4) == 0)                                  
369 +    return kFALSE;
370 +  return kTRUE;
371 + }
372 +
373 + //--------------------------------------------------------------------------------------------------
374 + inline Bool_t mithep::Muon::TMOneStation(Double_t iDYMin, Double_t iPYMin,
375 +                                         Double_t iDXMin, Double_t iPXMin, Int_t iN) const
376 + {
377 +  // Check if the muon is matched to at least one station (chamber).
378 +
379 +  if (NSegments() < iN)
380 +    return kFALSE; //second last one
381 +
382 +  Bool_t pGoodX  = kFALSE;
383 +  Bool_t pBadY   = kFALSE;
384 +  for (Int_t i0 = 0; i0 < 8; ++i0) {
385 +    if ((TMath::Abs(GetDX(i0))    < iDXMin  ||
386 +         TMath::Abs(GetPullX(i0)) < iPXMin))
387 +      pGoodX = kTRUE;
388 +    if (pGoodX &&
389 +        (TMath::Abs(GetDY(i0))    < iDYMin  ||
390 +         TMath::Abs(GetPullY(i0)) < iPYMin))  
391 +      return kTRUE;
392 +    if (TMath::Abs(GetDY(i0)) < 999999)
393 +      pBadY = kTRUE;
394 +    if (i0 == 3 && pGoodX && !pBadY)            
395 +      return kTRUE;
396 +  }
397 +  return kFALSE;
398 + }
399 +
400 + //--------------------------------------------------------------------------------------------------
401 + inline Bool_t mithep::Muon::TMLastStation(Double_t iDYMin, Double_t iPYMin,
402 +                                          Double_t iDXMin, Double_t iPXMin, Int_t iN) const
403 + {
404 +  // Check if the muon is matched to its last station (chamber).
405 +  
406 +  if (NSegments() < iN)
407 +    return kFALSE; //second last one
408 +
409 +  Int_t lLast = LastStation(-3.,-3.); // last required station
410 +  if (lLast < 0)                                  
411 +    return kFALSE;
412 +  if (GetDX(lLast) > 9999.)                
413 +    return kFALSE;
414 +  lLast = LastStation(); //no requirements
415 +  if (lLast < 0)                                  
416 +    return kFALSE;
417 +  if (!(TMath::Abs(GetDX(lLast))    < iDXMin  ||
418 +        TMath::Abs(GetPullX(lLast)) < iPXMin))  
419 +    return kFALSE;
420 +  if (lLast == 3)
421 +    lLast = LastStation(3);
422 +  if (lLast < 0)                                  
423 +    return kFALSE;
424 +  if (!(TMath::Abs(GetDY(lLast))    < iDYMin ||
425 +        TMath::Abs(GetPullY(lLast)) < iPYMin))  
426 +    return kFALSE;
427 +  return kTRUE;
428 + }
429 +
430 + //--------------------------------------------------------------------------------------------------
431 + inline void mithep::Muon::SetDX(Int_t iStation, Double_t iDX)
432 + {
433 +  // Return uncertainty in x in given chamber.
434 +
435 +  assert(iStation >= 0 && iStation < 8);
436 +  fDX[iStation] = iDX;
437 + }
438 +
439 + //--------------------------------------------------------------------------------------------------
440 + inline void mithep::Muon::SetDY(Int_t iStation, Double_t iDY)
441 + {
442 +  // Return uncertainty in y in given chamber.
443 +
444 +  assert(iStation >= 0 && iStation < 8);
445 +  fDY[iStation] = iDY;
446 + }
447 +
448 + //--------------------------------------------------------------------------------------------------
449 + inline void mithep::Muon::SetPullX(Int_t iStation, Double_t iPullX)
450 + {
451 +  // Set pull in x in given chamber.
452 +
453 +  assert(iStation >= 0 && iStation < 8);
454 +  fPullX[iStation] = iPullX;
455 + }
456 +
457 + //--------------------------------------------------------------------------------------------------
458 + inline void mithep::Muon::SetPullY(Int_t iStation, Double_t iPullY)
459 + {
460 +  // Set pull in y in given chamber.
461 +
462 +  assert(iStation >= 0 && iStation < 8);
463 +  fPullY[iStation] = iPullY;
464 + }
465 +
466 + //--------------------------------------------------------------------------------------------------
467 + inline void mithep::Muon::SetTrackDist(Int_t iStation, Double_t iDist)
468 + {
469 +  // Set track distance in given chamber.
470 +
471 +  assert(iStation >= 0 && iStation < 8);
472 +  fTrackDist[iStation] = iDist;
473 + }
474 +
475 + //--------------------------------------------------------------------------------------------------
476 + inline void mithep::Muon::SetTrackDistErr(Int_t iStation, Double_t iDistErr)
477 + {
478 +  // Set error of track distance in given chamber.
479 +
480 +  assert(iStation >= 0 && iStation < 8);
481 +  fTrackDistErr[iStation] = iDistErr;
482 + }
483 +
484 + //--------------------------------------------------------------------------------------------------
485 + inline void mithep::Muon::SetNSegments(Int_t iStation, Int_t NSegments)
486 + {
487 +  // Set number of segments in chamber.
488 +
489 +  assert(iStation >= 0 && iStation < 8);
490 +  fNSegments[iStation] = NSegments;
491 + }
492   #endif
493 +
494 +
495 +
496 +
497 +

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines