]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONRecoParam.cxx
AliMUONDigitCalibrator
[u/mrichter/AliRoot.git] / MUON / AliMUONRecoParam.cxx
1 /**************************************************************************
2 * Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
3 *                                                                        *
4 * Author: The ALICE Off-line Project.                                    *
5 * Contributors are mentioned in the code where appropriate.              *
6 *                                                                        *
7 * Permission to use, copy, modify and distribute this software and its   *
8 * documentation strictly for non-commercial purposes is hereby granted   *
9 * without fee, provided that the above copyright notice appears in all   *
10 * copies and that both the copyright notice and this permission notice   *
11 * appear in the supporting documentation. The authors make no claims     *
12 * about the suitability of this software for any purpose. It is          *
13 * provided "as is" without express or implied warranty.                  *
14 **************************************************************************/
15
16 // $Id$
17
18 //-----------------------------------------------------------------------------
19 /// \class AliMUONRecoParam
20 ///
21 /// Class with MUON reconstruction parameters
22 ///
23 ///  \author Philippe Pillot
24 //-----------------------------------------------------------------------------
25
26
27
28 #include "AliMUONRecoParam.h"
29 #include "AliMUONPadStatusMaker.h"
30
31 #include "AliRecoParam.h"
32 #include "AliLog.h"
33
34 #include <Riostream.h>
35
36 ClassImp(AliMUONRecoParam)
37
38
39 //_____________________________________________________________________________
40 AliMUONRecoParam::AliMUONRecoParam()
41 : AliDetectorRecoParam(),
42   fClusteringMode("MLEM"),
43   fTrackingMode("KALMAN"),
44   fMinBendingMomentum(0.),
45   fMaxBendingMomentum(0.),
46   fMaxNonBendingSlope(0.),
47   fMaxBendingSlope(0.),
48   fNonBendingVertexDispersion(0.),
49   fBendingVertexDispersion(0.),
50   fMaxNonBendingDistanceToTrack(0.),
51   fMaxBendingDistanceToTrack(0.),
52   fSigmaCutForTracking(0.),
53   fSigmaCutForImprovement(0.),
54   fSigmaCutForTrigger(0.),
55   fStripCutForTrigger(0.),
56   fMaxStripAreaForTrigger(0.),
57   fMaxNormChi2MatchTrigger(0.),
58   fPercentOfFullClusterInESD(10.),
59   fCombinedClusterTrackReco(kFALSE),
60   fTrackAllTracks(kFALSE),
61   fRecoverTracks(kFALSE),
62   fMakeTrackCandidatesFast(kFALSE),
63   fMakeMoreTrackCandidates(kFALSE),
64   fComplementTracks(kFALSE),
65   fImproveTracks(kFALSE),
66   fUseSmoother(kFALSE),
67   fSaveFullClusterInESD(kTRUE),
68   fCalibrationMode("NOGAIN"),
69   fBypassSt45(0),
70   fPadGoodnessMask(0),
71   fChargeSigmaCut(4.0),
72   fRemoveConnectedTracksInSt12(kFALSE),
73   fMaxTriggerTracks(0),
74   fMaxTrackCandidates(0),
75   fSelectTrackOnSlope(kFALSE)
76 {
77   /// Constructor
78   
79   SetNameTitle("Dummy","Dummy");
80   SetDefaultLimits();
81 }
82
83 //_____________________________________________________________________________
84 AliMUONRecoParam::~AliMUONRecoParam() 
85 {
86   /// Destructor
87 }
88
89 //_____________________________________________________________________________
90 void
91 AliMUONRecoParam::BypassSt45(Bool_t st4, Bool_t st5)
92 {
93         /// Set the bypass status
94         
95         if ( st4 && st5 ) fBypassSt45 = 45;
96         else if ( st4 ) fBypassSt45 = 4;
97         else if ( st5 ) fBypassSt45 = 5;
98         else fBypassSt45 = 0;
99 }
100
101 //_____________________________________________________________________________
102 Option_t*
103 AliMUONRecoParam::GetCalibrationMode() const
104 {
105   /// Return the calibration mode. Can be : 
106   /// NOGAIN : only do pedestal subtraction
107   /// GAIN : do pedestal subtraction, and apply gain correction, but with a
108   ///        single capacitance value for all channels
109   /// INJECTIONGAIN : as GAIN, but with gain values taken as EMELEC factory values
110   /// GAINCONSTANTCAPA : as GAIN, but with a channel-dependent capacitance value
111   
112   return fCalibrationMode.Data();
113 }
114
115 //_____________________________________________________________________________
116 AliMUONRecoParam *AliMUONRecoParam::GetLowFluxParam() 
117 {
118   /// Return default reconstruction parameters for low flux environment
119   
120   AliMUONRecoParam *param = new AliMUONRecoParam();
121   param->SetLowFluxParam();
122   
123   return param;
124 }
125
126 //_____________________________________________________________________________
127 AliMUONRecoParam *AliMUONRecoParam::GetHighFluxParam() 
128 {
129   /// Return default reconstruction parameters for high flux environment
130   
131   AliMUONRecoParam *param = new AliMUONRecoParam();
132   param->SetHighFluxParam();
133  
134   return param;
135 }
136
137 //_____________________________________________________________________________
138 AliMUONRecoParam *AliMUONRecoParam::GetCosmicParam() 
139 {
140   /// Return default reconstruction parameters for high flux environment
141   
142   AliMUONRecoParam *param = new AliMUONRecoParam();
143   param->SetCosmicParam();
144   
145   return param;
146 }
147
148 //_____________________________________________________________________________
149 void AliMUONRecoParam::SetLowFluxParam() 
150 {
151   /// Set reconstruction parameters for low flux environment
152   
153   SetNameTitle("Low Flux","Low Flux");
154   SetEventSpecie(AliRecoParam::kLowMult);
155   fMinBendingMomentum = 1.;
156   fMaxBendingMomentum = 3000.;
157   fMaxNonBendingSlope = 0.3;
158   fMaxBendingSlope = 0.4;
159   fSelectTrackOnSlope = kFALSE;
160   fNonBendingVertexDispersion = 70.;
161   fBendingVertexDispersion = 70.;
162   fMaxNonBendingDistanceToTrack = 1.;
163   fMaxBendingDistanceToTrack = 1.;
164   fSigmaCutForTracking = 6.;
165   fSigmaCutForImprovement = 5.;
166   fSigmaCutForTrigger = 8.;
167   fStripCutForTrigger = 1.;
168   fMaxStripAreaForTrigger = 3.;
169   fMaxNormChi2MatchTrigger = 16.;
170   fCombinedClusterTrackReco = kFALSE;
171   fTrackAllTracks = kTRUE;
172   fRecoverTracks = kTRUE;
173   fMakeTrackCandidatesFast = kFALSE;
174   fMakeMoreTrackCandidates = kFALSE;
175   fComplementTracks = kTRUE;
176   fImproveTracks = kTRUE;
177   fRemoveConnectedTracksInSt12 = kTRUE;
178   fUseSmoother = kTRUE;
179   for (Int_t iCh = 0; iCh < 10; iCh++) {
180     fUseChamber[iCh] = kTRUE;
181     fDefaultNonBendingReso[iCh] = 0.144;
182     fDefaultBendingReso[iCh] = 0.01;
183   }
184   for (Int_t iSt = 0; iSt < 5; iSt++) fRequestStation[iSt] = kTRUE;
185   fBypassSt45 = 0;
186   fMaxTriggerTracks = 100;
187   fMaxTrackCandidates = 10000;
188   
189 }
190
191 //_____________________________________________________________________________
192 void AliMUONRecoParam::SetHighFluxParam() 
193 {
194   /// Set reconstruction parameters for high flux environment
195   
196   SetNameTitle("High Flux","High Flux");
197   SetEventSpecie(AliRecoParam::kHighMult);
198   fMinBendingMomentum = 1.;
199   fMaxBendingMomentum = 3000.;
200   fMaxNonBendingSlope = 0.3;
201   fMaxBendingSlope = 0.4;
202   fSelectTrackOnSlope = kFALSE;
203   fNonBendingVertexDispersion = 70.;
204   fBendingVertexDispersion = 70.;
205   fMaxNonBendingDistanceToTrack = 1.;
206   fMaxBendingDistanceToTrack = 1.;
207   fSigmaCutForTracking = 6.;
208   fSigmaCutForImprovement = 5.;
209   fSigmaCutForTrigger = 8.;
210   fStripCutForTrigger = 1.;
211   fMaxStripAreaForTrigger = 3.;
212   fMaxNormChi2MatchTrigger = 16.;
213   fCombinedClusterTrackReco = kFALSE;
214   fTrackAllTracks = kTRUE;
215   fRecoverTracks = kTRUE;
216   fMakeTrackCandidatesFast = kFALSE;
217   fMakeMoreTrackCandidates = kFALSE;
218   fComplementTracks = kTRUE;
219   fImproveTracks = kTRUE;
220   fRemoveConnectedTracksInSt12 = kFALSE;
221   fUseSmoother = kTRUE;
222   for (Int_t iCh = 0; iCh < 10; iCh++) {
223     fUseChamber[iCh] = kTRUE;
224     fDefaultNonBendingReso[iCh] = 0.144;
225     fDefaultBendingReso[iCh] = 0.01;
226   }
227   for (Int_t iSt = 0; iSt < 5; iSt++) fRequestStation[iSt] = kTRUE;
228   fBypassSt45 = 0;
229   fMaxTriggerTracks = 100;
230   fMaxTrackCandidates = 10000;
231   
232 }
233
234 //_____________________________________________________________________________
235 void AliMUONRecoParam::SetCosmicParam() 
236 {
237   /// Set reconstruction parameters for high flux environment
238   
239   SetNameTitle("Cosmic","Cosmic");
240   SetEventSpecie(AliRecoParam::kCosmic);
241   fMinBendingMomentum = 1.;
242   fMaxBendingMomentum = 10000000.;
243   fMaxNonBendingSlope = 0.4;
244   fMaxBendingSlope = 0.5;
245   fSelectTrackOnSlope = kTRUE;
246   fNonBendingVertexDispersion = 200.;
247   fBendingVertexDispersion = 200.;
248   fMaxNonBendingDistanceToTrack = 1.;
249   fMaxBendingDistanceToTrack = 1.;
250   fSigmaCutForTracking = 7.;
251   fSigmaCutForImprovement = 7.;
252   fSigmaCutForTrigger = 8.;
253   fStripCutForTrigger = 1.5;
254   fMaxStripAreaForTrigger = 3.;
255   fMaxNormChi2MatchTrigger = 16.;
256   fPercentOfFullClusterInESD = 100.;
257   fCombinedClusterTrackReco = kFALSE;
258   fTrackAllTracks = kTRUE;
259   fRecoverTracks = kTRUE;
260   fMakeTrackCandidatesFast = kFALSE;
261   fMakeMoreTrackCandidates = kFALSE;
262   fComplementTracks = kTRUE;
263   fImproveTracks = kTRUE;
264   fRemoveConnectedTracksInSt12 = kTRUE;
265   fUseSmoother = kTRUE;
266   fSaveFullClusterInESD = kTRUE;
267   for (Int_t iCh = 0; iCh < 10; iCh++) {
268     fUseChamber[iCh] = kTRUE;
269     fDefaultNonBendingReso[iCh] = 0.4;
270     fDefaultBendingReso[iCh] = 0.4;
271   }
272   for (Int_t iSt = 0; iSt < 5; iSt++) fRequestStation[iSt] = kTRUE;
273   fBypassSt45 = 0;
274   fPadGoodnessMask = 0x400BE80; // Ped Mean is Zero | Ped Mean Too Low | Ped Mean Too High | Ped Sigma Too Low | Ped Sigma Too High | Ped is missing | HV is missing | manu occupancy too high
275   fMaxTriggerTracks = 100;
276   fMaxTrackCandidates = 10000;
277   SetManuOccupancyLimits(-1,0.5); // reject manu above occ=50%
278   
279 }
280
281 //_____________________________________________________________________________
282 UInt_t
283 AliMUONRecoParam::RequestedStationMask() const
284 {
285   /// Get the mask of the requested station, i.e. an integer where 
286   /// bit n is set to one if the station n was requested
287   
288   UInt_t m(0);
289   
290   for ( Int_t i = 0; i < 5; ++i ) 
291   {
292     if ( RequestStation(i) ) m |= ( 1 << i );
293   }
294   return m;
295 }
296
297 //_____________________________________________________________________________
298 void AliMUONRecoParam::Print(Option_t *option) const
299 {
300   /// print reconstruction parameters
301   /// if option = FULL then print also unused parameters
302   
303   cout<<endl<<"\t------MUON Reconstruction parameters ("<<GetName()<<")------"<<endl;
304   
305   if (IsDefault()) cout<<"\t\t*** Parameters used by default ***"<<endl;
306   
307   cout<<Form("Calibration mode = %s",fCalibrationMode.Data())<<endl;
308   cout<<Form("Clustering mode = %s",fClusteringMode.Data())<<endl;
309   cout<<Form("Tracking mode = %s",fTrackingMode.Data())<<endl;
310
311         TString bypass;
312         
313         if ( BypassSt45() )
314         {
315                 bypass = "stations 4 and 5";
316         }
317         else if ( BypassSt4() ) 
318         {
319                 bypass = "station 4";
320         }
321         else if ( BypassSt5() ) 
322         {
323                 bypass = "station 5";
324         }
325         
326   if (bypass.Length()) cout << "Will bypass " << bypass.Data() << " (replacing real clusters by generated ones from trigger tracks)" << endl;
327   
328   if (fCombinedClusterTrackReco) cout<<"Combined cluster/track reconstruction: ON"<<endl;
329   else cout<<"Combined cluster/track reconstruction: OFF"<<endl;
330   
331   if (fSaveFullClusterInESD) cout<<Form("Save all cluster info in ESD for %5.2f %% of events",fPercentOfFullClusterInESD)<<endl;
332   else cout<<"Save partial cluster info in ESD"<<endl;
333     
334   cout<<"Selection of track candidates:"<<endl;
335   if (fSelectTrackOnSlope) cout<<Form("\t- Non-bending slope < %5.2f",fMaxNonBendingSlope)<<endl;
336   else cout<<"\t- Impact parameter < 3 * vertex dispersion in the non-bending direction"<<endl;
337   cout<<Form("\t- if B!=0: Bending momentum > %5.2f",fMinBendingMomentum)<<endl;
338   if (fSelectTrackOnSlope) cout<<Form("\t  if B==0: Bending slope < %5.2f",fMaxBendingSlope)<<endl;
339   else cout<<"\t  if B==0: Impact parameter < 3 * vertex dispersion in the bending direction"<<endl;
340   
341   cout<<Form("Vertex dispersion (used to estimate initial bending momentum resolution) = (%5.2f,%5.2f)",fNonBendingVertexDispersion,fBendingVertexDispersion)<<endl;
342   
343   cout<<Form("Maximum distance to track = (%5.2f,%5.2f)",fMaxNonBendingDistanceToTrack,fMaxBendingDistanceToTrack)<<endl;
344   
345   cout<<Form("Sigma cut for tracking = %5.2f",fSigmaCutForTracking)<<endl;
346
347   cout<<Form("Sigma cut for trigger hit pattern = %5.2f",fSigmaCutForTrigger)<<endl;
348
349   cout<<Form("Cut in strips for trigger chamber efficiency = %5.2f",fStripCutForTrigger)<<endl;
350
351   cout<<Form("Max search area in strips for trigger chamber efficiency = %5.2f",fMaxStripAreaForTrigger)<<endl;
352
353   if (fTrackAllTracks) cout<<"Track all the possible candidates"<<endl;
354   else cout<<"Track only the best candidates"<<endl;
355   
356   if (strstr(option,"FULL")) {
357     cout<<"Make track candidates assuming linear propagation between stations 4 and 5: ";
358     if (fMakeTrackCandidatesFast) cout<<"ON"<<endl;
359     else cout<<"OFF"<<endl;
360   } else if (fMakeTrackCandidatesFast)
361     cout<<"Make track candidates assuming linear propagation between stations 4 and 5"<<endl;
362   
363   if (strstr(option,"FULL")) {
364     cout<<"Make track candidates starting from 1 cluster in each of the stations 4 and 5: ";
365     if (fMakeMoreTrackCandidates) cout<<"ON"<<endl;
366     else cout<<"OFF"<<endl;
367   } else if (fMakeMoreTrackCandidates)
368     cout<<"Make track candidates starting from 1 cluster in each of the stations 4 and 5"<<endl;
369   
370   if (strstr(option,"FULL")) {
371     cout<<"Try to recover tracks getting lost during tracking: ";
372     if (fRecoverTracks) cout<<"ON"<<endl;
373     else cout<<"OFF"<<endl;
374   } else if (fRecoverTracks)
375     cout<<"Try to recover tracks getting lost during tracking"<<endl;
376   
377   if (strstr(option,"FULL")) {
378     cout<<"Try to complete the reconstructed tracks by adding missing clusters: ";
379     if (fComplementTracks) cout<<"ON"<<endl;
380     else cout<<"OFF"<<endl;
381   } else if (fComplementTracks)
382     cout<<"Try to complete the reconstructed tracks by adding missing clusters"<<endl;
383   
384   if (strstr(option,"FULL")) {
385     cout<<"Try to improve the reconstructed tracks by removing bad clusters: ";
386     if (fImproveTracks) cout<<Form("ON (sigma cut = %5.2f)",fSigmaCutForImprovement)<<endl;
387     else cout<<"OFF"<<endl;
388   } else if (fImproveTracks)
389     cout<<Form("Try to improve the reconstructed tracks by removing bad clusters (sigma cut = %5.2f)",fSigmaCutForImprovement)<<endl;
390   
391   if (fRemoveConnectedTracksInSt12) cout<<"Remove tracks sharing one cluster or more in any station"<<endl;
392   else cout<<"Remove tracks sharing one cluster or more in stations 3, 4 and 5"<<endl;
393   
394   if (strstr(option,"FULL")) {
395     cout<<"Use smoother to compute final track parameters, etc, at each cluster (used for Kalman tracking only): ";
396     if (fUseSmoother) cout<<"ON"<<endl;
397     else cout<<"OFF"<<endl;
398   } else if (fUseSmoother)
399     cout<<"Use smoother to compute final track parameters, etc, at each cluster"<<endl;
400   
401   cout<<Form("Maximum normalized chi2 of tracking/trigger track matching = %5.2f",fMaxNormChi2MatchTrigger)<<endl;
402   
403   Bool_t discardedCh = kFALSE;
404   Int_t ch = 0;
405   do {
406     if (!UseChamber(ch)) {
407       if (!discardedCh) {
408         cout<<"Discarded chambers(1..): "<<ch+1;
409         discardedCh = kTRUE;
410       }
411       else cout<<" "<<ch+1;
412     }
413   } while (++ch < 10);
414   if (discardedCh) cout<<endl;
415   
416   Bool_t discardedSt = kFALSE;
417   Int_t st = 0;
418   do {
419     if (!RequestStation(st)) {
420       if (!discardedSt) {
421         cout<<"Not requested stations(1..): "<<st+1;
422         discardedSt = kTRUE;
423       }
424       else cout<<" "<<st+1;
425     }
426   } while (++st < 5);
427   if (discardedSt) cout<<endl;
428   
429   cout << Form("Pad goodness policy mask is 0x%x",PadGoodnessMask()) << endl;
430   cout << "Which means we reject pads having the condition = " <<
431   AliMUONPadStatusMaker::AsCondition(PadGoodnessMask()).Data() << endl;
432   
433   cout << "The pad limits we are using are :" << endl;
434   
435   cout << Form("%5.0f <= HVSt12 <= %5.0f Volts",HVSt12LowLimit(),HVSt12HighLimit()) << endl;
436   cout << Form("%5.0f <= HVSt345 <= %5.0f Volts",HVSt345LowLimit(),HVSt345HighLimit()) << endl;
437   cout << Form("%7.2f <= Pedestal mean <= %7.2f",PedMeanLowLimit(),PedMeanHighLimit()) << endl;
438   cout << Form("%7.2f <= Pedestal sigma <= %7.2f",PedSigmaLowLimit(),PedSigmaHighLimit()) << endl;
439   cout << Form("%e <= Gain linear term <= %e",GainA1LowLimit(),GainA1HighLimit()) << endl;
440   cout << Form("%e <= Gain quadratic term <= %e",GainA2LowLimit(),GainA2HighLimit()) << endl;
441   cout << Form("%5.0f <= Gain threshold term <= %5.0f",GainThresLowLimit(),GainThresHighLimit()) << endl;
442     
443   cout << Form("And we cut on charge >= %7.2f x ( pedestal sigma ) ",ChargeSigmaCut()) << endl;
444   
445   cout << "Occupancy limits are :" << endl;
446   
447   cout << Form("%7.2f <= Manu occupancy < %7.2f",ManuOccupancyLowLimit(),ManuOccupancyHighLimit()) << endl;
448   cout << Form("%7.2f <= Buspatch occupancy < %7.2f",BuspatchOccupancyLowLimit(),BuspatchOccupancyHighLimit()) << endl;
449   cout << Form("%7.2f <= DE occupancy < %7.2f",DEOccupancyLowLimit(),DEOccupancyHighLimit()) << endl;
450   
451   cout << "chamber non bending resolution = |";
452   for (Int_t iCh = 0; iCh < 10; iCh++) cout << Form(" %6.3f |",fDefaultNonBendingReso[iCh]);
453   cout << endl;
454   cout << "chamber bending resolution = |";
455   for (Int_t iCh = 0; iCh < 10; iCh++) cout << Form(" %6.3f |",fDefaultBendingReso[iCh]);
456   cout << endl;
457   cout<<Form("maximum number of trigger tracks above which the tracking is cancelled = %d",fMaxTriggerTracks)<<endl;
458   cout<<Form("maximum number of track candidates above which the tracking is abandonned = %d",fMaxTrackCandidates)<<endl;
459   
460   cout<<"\t-----------------------------------------------------"<<endl<<endl;
461   
462 }
463
464 //_____________________________________________________________________________
465 void
466 AliMUONRecoParam::SetDefaultLimits()
467 {
468         /// Set the default limits and pad goodness policy
469
470         fHVSt12Limits[0]=1500;
471         fHVSt12Limits[1]=2000;
472
473         fHVSt345Limits[0]=1500;
474         fHVSt345Limits[1]=2000;
475
476         fPedMeanLimits[0] = 50;
477         fPedMeanLimits[1] = 1024;
478         
479         fPedSigmaLimits[0] = 0.6;
480         fPedSigmaLimits[1] = 100;
481
482         fGainA1Limits[0] = 0.1;
483         fGainA1Limits[1] = 10;
484
485         fGainA2Limits[0] = -1E30;
486         fGainA2Limits[1] = 1E30;
487         
488         fGainThresLimits[0] = 0;
489         fGainThresLimits[1] = 4095;
490         
491         fPadGoodnessMask = 0x8080; // Ped is missing | HV is missing
492
493   fManuOccupancyLimits[0] = -1.0; 
494   fManuOccupancyLimits[1] = 1.0;
495
496   fBuspatchOccupancyLimits[0] = -1.0; 
497   fBuspatchOccupancyLimits[1] = 1.0;
498
499   fDEOccupancyLimits[0] = -1.0; 
500   fDEOccupancyLimits[1] = 1.0;
501
502   fChargeSigmaCut = 4.0;
503 }
504