]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONRecoParam.cxx
Dump object functionality
[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 "AliCDBManager.h"
35 #include "AliCDBEntry.h"
36
37 #include <Riostream.h>
38
39 using std::cout;
40 using std::endl;
41 ClassImp(AliMUONRecoParam)
42
43
44 //_____________________________________________________________________________
45 AliMUONRecoParam::AliMUONRecoParam()
46 : AliDetectorRecoParam(),
47   fClusteringMode("MLEM"),
48   fTrackingMode("KALMAN"),
49   fMinBendingMomentum(0.),
50   fMaxBendingMomentum(0.),
51   fMaxNonBendingSlope(0.),
52   fMaxBendingSlope(0.),
53   fNonBendingVertexDispersion(0.),
54   fBendingVertexDispersion(0.),
55   fMaxNonBendingDistanceToTrack(0.),
56   fMaxBendingDistanceToTrack(0.),
57   fSigmaCutForTracking(0.),
58   fSigmaCutForImprovement(0.),
59   fSigmaCutForTrigger(0.),
60   fStripCutForTrigger(0.),
61   fMaxStripAreaForTrigger(0.),
62   fMaxNormChi2MatchTrigger(0.),
63   fPercentOfFullClusterInESD(10.),
64   fCombinedClusterTrackReco(kFALSE),
65   fTrackAllTracks(kFALSE),
66   fRecoverTracks(kFALSE),
67   fMakeTrackCandidatesFast(kFALSE),
68   fMakeMoreTrackCandidates(kFALSE),
69   fComplementTracks(kFALSE),
70   fImproveTracks(kFALSE),
71   fUseSmoother(kFALSE),
72   fSaveFullClusterInESD(kTRUE),
73   fCalibrationMode("NOGAIN"),
74   fBypassSt45(0),
75   fPadGoodnessMask(0),
76   fChargeSigmaCut(4.0),
77   fRemoveConnectedTracksInSt12(kFALSE),
78   fMaxTriggerTracks(0),
79   fMaxTrackCandidates(0),
80   fSelectTrackOnSlope(kFALSE),
81   fMissingPadFractionLimit(-1),
82   fFractionOfBuspatchOutsideOccupancyLimit(0),
83   fAverageNoisePadCharge(0.22875),
84   fClusterChargeCut(2.0),
85   fEventSizeSoftLimit(35.0),
86   fEventSizeHardLimit(45.0),
87   fTokenLostLimit(0.0),
88   fTryRecover(kFALSE),
89   fDiscardMonoCathodClusters(kFALSE),
90   fMonoCathodClNonBendingRes(0.),
91   fMonoCathodClBendingRes(0.)
92 {  
93   /// Constructor
94   
95   SetNameTitle("Dummy","Dummy");
96   for (Int_t iCh = 0; iCh < 10; iCh++) {
97     fUseChamber[iCh] = kTRUE;
98     fDefaultNonBendingReso[iCh] = 0.;
99     fDefaultBendingReso[iCh] = 0.;
100   }
101   for (Int_t iSt = 0; iSt < 5; iSt++) fRequestStation[iSt] = kTRUE;
102   SetDefaultLimits();
103 }
104
105 //_____________________________________________________________________________
106 AliMUONRecoParam::~AliMUONRecoParam() 
107 {
108   /// Destructor
109 }
110
111 //_____________________________________________________________________________
112 void
113 AliMUONRecoParam::BypassSt45(Bool_t st4, Bool_t st5)
114 {
115         /// Set the bypass status
116         
117         if ( st4 && st5 ) fBypassSt45 = 45;
118         else if ( st4 ) fBypassSt45 = 4;
119         else if ( st5 ) fBypassSt45 = 5;
120         else fBypassSt45 = 0;
121 }
122
123 //_____________________________________________________________________________
124 Option_t*
125 AliMUONRecoParam::GetCalibrationMode() const
126 {
127   /// Return the calibration mode. Can be : 
128   /// NOGAIN : only do pedestal subtraction
129   /// GAIN : do pedestal subtraction, and apply gain correction, but with a
130   ///        single capacitance value for all channels
131   /// INJECTIONGAIN : as GAIN, but with gain values taken as EMELEC factory values
132   /// GAINCONSTANTCAPA : as GAIN, but with a channel-dependent capacitance value
133   
134   return fCalibrationMode.Data();
135 }
136
137 //_____________________________________________________________________________
138 AliMUONRecoParam *AliMUONRecoParam::GetLowFluxParam() 
139 {
140   /// Return default reconstruction parameters for low flux environment
141   
142   AliMUONRecoParam *param = new AliMUONRecoParam();
143   param->SetLowFluxParam();
144   
145   return param;
146 }
147
148 //_____________________________________________________________________________
149 AliMUONRecoParam *AliMUONRecoParam::GetHighFluxParam() 
150 {
151   /// Return default reconstruction parameters for high flux environment
152   
153   AliMUONRecoParam *param = new AliMUONRecoParam();
154   param->SetHighFluxParam();
155  
156   return param;
157 }
158
159 //_____________________________________________________________________________
160 AliMUONRecoParam *AliMUONRecoParam::GetCosmicParam() 
161 {
162   /// Return default reconstruction parameters for high flux environment
163   
164   AliMUONRecoParam *param = new AliMUONRecoParam();
165   param->SetCosmicParam();
166   
167   return param;
168 }
169
170 //_____________________________________________________________________________
171 AliMUONRecoParam *AliMUONRecoParam::GetCalibrationParam() 
172 {
173   /// Return default (dummy) reconstruction parameters for calibration environment
174   
175   AliMUONRecoParam *param = new AliMUONRecoParam();
176   param->SetCalibrationParam();
177   
178   return param;
179 }
180
181
182 //_____________________________________________________________________________
183 void AliMUONRecoParam::SetLowFluxParam() 
184 {
185   /// Set reconstruction parameters for low flux environment
186   
187   SetNameTitle("Low Flux","Low Flux");
188   SetEventSpecie(AliRecoParam::kLowMult);
189   fMinBendingMomentum = 0.8;
190   fMaxBendingMomentum = 1.e10;
191   fMaxNonBendingSlope = 0.3;
192   fMaxBendingSlope = 0.4;
193   fSelectTrackOnSlope = kFALSE;
194   fNonBendingVertexDispersion = 70.;
195   fBendingVertexDispersion = 70.;
196   fMaxNonBendingDistanceToTrack = 1.;
197   fMaxBendingDistanceToTrack = 1.;
198   fSigmaCutForTracking = 6.;
199   fSigmaCutForImprovement = 5.;
200   fSigmaCutForTrigger = 4.;
201   fStripCutForTrigger = 1.;
202   fMaxStripAreaForTrigger = 3.;
203   fMaxNormChi2MatchTrigger = fSigmaCutForTrigger * fSigmaCutForTrigger;
204   fCombinedClusterTrackReco = kFALSE;
205   fTrackAllTracks = kTRUE;
206   fRecoverTracks = kTRUE;
207   fMakeTrackCandidatesFast = kFALSE;
208   fMakeMoreTrackCandidates = kFALSE;
209   fComplementTracks = kTRUE;
210   fImproveTracks = kTRUE;
211   fRemoveConnectedTracksInSt12 = kFALSE;
212   fUseSmoother = kTRUE;
213   for (Int_t iCh = 0; iCh < 10; iCh++) {
214     fUseChamber[iCh] = kTRUE;
215     fDefaultNonBendingReso[iCh] = 0.144;
216     fDefaultBendingReso[iCh] = 0.01;
217   }
218   for (Int_t iSt = 0; iSt < 5; iSt++) fRequestStation[iSt] = kTRUE;
219   fBypassSt45 = 0;
220   fMaxTriggerTracks = 100;
221   fMaxTrackCandidates = 10000;  
222   fDiscardMonoCathodClusters = kFALSE;
223   fMonoCathodClNonBendingRes = 10.;
224   fMonoCathodClBendingRes = 10.;
225 }
226
227 //_____________________________________________________________________________
228 void AliMUONRecoParam::SetHighFluxParam() 
229 {
230   /// Set reconstruction parameters for high flux environment
231   
232   SetNameTitle("High Flux","High Flux");
233   SetEventSpecie(AliRecoParam::kHighMult);
234   fMinBendingMomentum = 0.8;
235   fMaxBendingMomentum = 1.e10;
236   fMaxNonBendingSlope = 0.3;
237   fMaxBendingSlope = 0.4;
238   fSelectTrackOnSlope = kFALSE;
239   fNonBendingVertexDispersion = 70.;
240   fBendingVertexDispersion = 70.;
241   fMaxNonBendingDistanceToTrack = 1.;
242   fMaxBendingDistanceToTrack = 1.;
243   fSigmaCutForTracking = 6.;
244   fSigmaCutForImprovement = 5.;
245   fSigmaCutForTrigger = 4.;
246   fStripCutForTrigger = 1.;
247   fMaxStripAreaForTrigger = 3.;
248   fMaxNormChi2MatchTrigger = fSigmaCutForTrigger * fSigmaCutForTrigger;
249   fCombinedClusterTrackReco = kFALSE;
250   fTrackAllTracks = kTRUE;
251   fRecoverTracks = kTRUE;
252   fMakeTrackCandidatesFast = kFALSE;
253   fMakeMoreTrackCandidates = kFALSE;
254   fComplementTracks = kTRUE;
255   fImproveTracks = kTRUE;
256   fRemoveConnectedTracksInSt12 = kFALSE;
257   fUseSmoother = kTRUE;
258   for (Int_t iCh = 0; iCh < 10; iCh++) {
259     fUseChamber[iCh] = kTRUE;
260     fDefaultNonBendingReso[iCh] = 0.144;
261     fDefaultBendingReso[iCh] = 0.01;
262   }
263   for (Int_t iSt = 0; iSt < 5; iSt++) fRequestStation[iSt] = kTRUE;
264   fBypassSt45 = 0;
265   fMaxTriggerTracks = 100;
266   fMaxTrackCandidates = 10000;
267   fDiscardMonoCathodClusters = kFALSE;
268   fMonoCathodClNonBendingRes = 10.;
269   fMonoCathodClBendingRes = 10.;
270 }
271
272 //_____________________________________________________________________________
273 void AliMUONRecoParam::SetCosmicParam() 
274 {
275   /// Set reconstruction parameters for high flux environment
276   
277   SetNameTitle("Cosmic","Cosmic");
278   SetEventSpecie(AliRecoParam::kCosmic);
279   fMinBendingMomentum = 0.8;
280   fMaxBendingMomentum = 1.e10;
281   fMaxNonBendingSlope = 0.3;
282   fMaxBendingSlope = 0.4;
283   fSelectTrackOnSlope = kTRUE;
284   fNonBendingVertexDispersion = 170.;
285   fBendingVertexDispersion = 170.;
286   fMaxNonBendingDistanceToTrack = 1.;
287   fMaxBendingDistanceToTrack = 1.;
288   fSigmaCutForTracking = 7.;
289   fSigmaCutForImprovement = 6.;
290   fSigmaCutForTrigger = 4.;
291   fStripCutForTrigger = 1.5;
292   fMaxStripAreaForTrigger = 3.;
293   fMaxNormChi2MatchTrigger = fSigmaCutForTrigger * fSigmaCutForTrigger;
294   fPercentOfFullClusterInESD = 100.;
295   fCombinedClusterTrackReco = kFALSE;
296   fTrackAllTracks = kTRUE;
297   fRecoverTracks = kTRUE;
298   fMakeTrackCandidatesFast = kFALSE;
299   fMakeMoreTrackCandidates = kFALSE;
300   fComplementTracks = kTRUE;
301   fImproveTracks = kTRUE;
302   fRemoveConnectedTracksInSt12 = kTRUE;
303   fUseSmoother = kTRUE;
304   fSaveFullClusterInESD = kTRUE;
305   for (Int_t iCh = 0; iCh < 10; iCh++) {
306     fUseChamber[iCh] = kTRUE;
307     fDefaultNonBendingReso[iCh] = 0.4;
308     fDefaultBendingReso[iCh] = 0.4;
309   }
310   fRequestStation[0] = kTRUE;
311   fRequestStation[1] = kTRUE;
312   fRequestStation[2] = kTRUE;
313   fRequestStation[3] = kTRUE;
314   fRequestStation[4] = kTRUE;
315   fBypassSt45 = 0;
316   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
317   fMaxTriggerTracks = 100;
318   fMaxTrackCandidates = 10000;
319   fDiscardMonoCathodClusters = kFALSE;
320   fMonoCathodClNonBendingRes = 10.;
321   fMonoCathodClBendingRes = 10.;
322   
323   SetPedMeanLimits(20, 700);
324   SetManuOccupancyLimits(-1.,0.01); // reject manu above occ=1%
325
326   SetBuspatchOccupancyLimits(-1,0.05);  
327   SetFractionOfBuspatchOutsideOccupancyLimit(0.10); // 10 %
328 }
329
330
331 //_____________________________________________________________________________
332 void AliMUONRecoParam::SetCalibrationParam() 
333 {
334   /// Set (dummy) reconstruction parameters for calibration environment
335   
336   SetNameTitle("Calibration","Calibration");
337   SetEventSpecie(AliRecoParam::kCalib);
338
339   fPedMeanLimits[0] = 5000;
340   fPedMeanLimits[1] = 0;
341
342   fPadGoodnessMask = 0x8C00; // Pedestal is missing | is too low | too high
343
344 }
345
346 //_____________________________________________________________________________
347 UInt_t
348 AliMUONRecoParam::RequestedStationMask() const
349 {
350   /// Get the mask of the requested station, i.e. an integer where 
351   /// bit n is set to one if the station n was requested
352   
353   UInt_t m(0);
354   
355   for ( Int_t i = 0; i < 5; ++i ) 
356   {
357     if ( RequestStation(i) ) m |= ( 1 << i );
358   }
359   return m;
360 }
361
362 //_____________________________________________________________________________
363 void AliMUONRecoParam::Print(Option_t *option) const
364 {
365   /// print reconstruction parameters
366   /// if option = FULL then print also unused parameters
367   
368   cout<<endl<<"\t------MUON Reconstruction parameters ("<<GetName()<<")------"<<endl;
369   
370   if (IsDefault()) cout<<"\t\t*** Parameters used by default ***"<<endl;
371   
372   cout << "Event Specie=" << GetEventSpecie() << endl;
373   
374   cout<<Form("Calibration mode = %s",fCalibrationMode.Data())<<endl;
375   cout<<Form("Clustering mode = %s",fClusteringMode.Data())<<endl;
376   cout<<Form("Tracking mode = %s",fTrackingMode.Data())<<endl;
377
378         TString bypass;
379         
380         if ( BypassSt45() )
381         {
382                 bypass = "stations 4 and 5";
383         }
384         else if ( BypassSt4() ) 
385         {
386                 bypass = "station 4";
387         }
388         else if ( BypassSt5() ) 
389         {
390                 bypass = "station 5";
391         }
392         
393   if (bypass.Length()) cout << "Will bypass " << bypass.Data() << " (replacing real clusters by generated ones from trigger tracks)" << endl;
394   
395   if (fCombinedClusterTrackReco) cout<<"Combined cluster/track reconstruction: ON"<<endl;
396   else cout<<"Combined cluster/track reconstruction: OFF"<<endl;
397   
398   if (fSaveFullClusterInESD) cout<<Form("Save all cluster info in ESD for %5.2f %% of events",fPercentOfFullClusterInESD)<<endl;
399   else cout<<"Save partial cluster info in ESD"<<endl;
400     
401   cout<<"Selection of track candidates:"<<endl;
402   if (fSelectTrackOnSlope) cout<<Form("\t- Non-bending slope < %5.2f",fMaxNonBendingSlope)<<endl;
403   else cout<<"\t- Impact parameter < 3 * vertex dispersion in the non-bending direction"<<endl;
404   cout<<Form("\t- if B!=0: Bending momentum > %5.2f",fMinBendingMomentum)<<endl;
405   if (fSelectTrackOnSlope) cout<<Form("\t  if B==0: Bending slope < %5.2f",fMaxBendingSlope)<<endl;
406   else cout<<"\t  if B==0: Impact parameter < 3 * vertex dispersion in the bending direction"<<endl;
407   
408   cout<<Form("Vertex dispersion (used to estimate initial bending momentum resolution) = (%5.2f,%5.2f)",fNonBendingVertexDispersion,fBendingVertexDispersion)<<endl;
409   
410   cout<<Form("Maximum distance to track = (%5.2f,%5.2f)",fMaxNonBendingDistanceToTrack,fMaxBendingDistanceToTrack)<<endl;
411   
412   cout<<Form("Sigma cut for tracking = %5.2f",fSigmaCutForTracking)<<endl;
413
414   cout<<Form("Sigma cut for trigger hit pattern = %5.2f",fSigmaCutForTrigger)<<endl;
415
416   cout<<Form("Cut in strips for trigger chamber efficiency = %5.2f",fStripCutForTrigger)<<endl;
417
418   cout<<Form("Max search area in strips for trigger chamber efficiency = %5.2f",fMaxStripAreaForTrigger)<<endl;
419
420   if (fTrackAllTracks) cout<<"Track all the possible candidates"<<endl;
421   else cout<<"Track only the best candidates"<<endl;
422   
423   if (strstr(option,"FULL")) {
424     cout<<"Make track candidates assuming linear propagation between stations 4 and 5: ";
425     if (fMakeTrackCandidatesFast) cout<<"ON"<<endl;
426     else cout<<"OFF"<<endl;
427   } else if (fMakeTrackCandidatesFast)
428     cout<<"Make track candidates assuming linear propagation between stations 4 and 5"<<endl;
429   
430   if (strstr(option,"FULL")) {
431     cout<<"Make track candidates starting from 1 cluster in each of the stations 4 and 5: ";
432     if (fMakeMoreTrackCandidates) cout<<"ON"<<endl;
433     else cout<<"OFF"<<endl;
434   } else if (fMakeMoreTrackCandidates)
435     cout<<"Make track candidates starting from 1 cluster in each of the stations 4 and 5"<<endl;
436   
437   if (strstr(option,"FULL")) {
438     cout<<"Try to recover tracks getting lost during tracking: ";
439     if (fRecoverTracks) cout<<"ON"<<endl;
440     else cout<<"OFF"<<endl;
441   } else if (fRecoverTracks)
442     cout<<"Try to recover tracks getting lost during tracking"<<endl;
443   
444   if (strstr(option,"FULL")) {
445     cout<<"Try to complete the reconstructed tracks by adding missing clusters: ";
446     if (fComplementTracks) cout<<"ON"<<endl;
447     else cout<<"OFF"<<endl;
448   } else if (fComplementTracks)
449     cout<<"Try to complete the reconstructed tracks by adding missing clusters"<<endl;
450   
451   if (strstr(option,"FULL")) {
452     cout<<"Try to improve the reconstructed tracks by removing bad clusters: ";
453     if (fImproveTracks) cout<<Form("ON (sigma cut = %5.2f)",fSigmaCutForImprovement)<<endl;
454     else cout<<"OFF"<<endl;
455   } else if (fImproveTracks)
456     cout<<Form("Try to improve the reconstructed tracks by removing bad clusters (sigma cut = %5.2f)",fSigmaCutForImprovement)<<endl;
457   
458   if (fRemoveConnectedTracksInSt12) cout<<"Remove tracks sharing one cluster or more in any station"<<endl;
459   else cout<<"Remove tracks sharing one cluster or more in stations 3, 4 and 5"<<endl;
460   
461   if (strstr(option,"FULL")) {
462     cout<<"Use smoother to compute final track parameters, etc, at each cluster (used for Kalman tracking only): ";
463     if (fUseSmoother) cout<<"ON"<<endl;
464     else cout<<"OFF"<<endl;
465   } else if (fUseSmoother)
466     cout<<"Use smoother to compute final track parameters, etc, at each cluster"<<endl;
467   
468   cout<<Form("Maximum normalized chi2 of tracking/trigger track matching = %5.2f",fMaxNormChi2MatchTrigger)<<endl;
469   
470   Bool_t discardedCh = kFALSE;
471   Int_t ch = 0;
472   do {
473     if (!UseChamber(ch)) {
474       if (!discardedCh) {
475         cout<<"Discarded chambers(1..): "<<ch+1;
476         discardedCh = kTRUE;
477       }
478       else cout<<" "<<ch+1;
479     }
480   } while (++ch < 10);
481   if (discardedCh) cout<<endl;
482   
483   Bool_t discardedSt = kFALSE;
484   Int_t st = 0;
485   do {
486     if (!RequestStation(st)) {
487       if (!discardedSt) {
488         cout<<"Not requested stations(1..): "<<st+1;
489         discardedSt = kTRUE;
490       }
491       else cout<<" "<<st+1;
492     }
493   } while (++st < 5);
494   if (discardedSt) cout<<endl;
495   
496   cout << Form("Pad goodness policy mask is 0x%x",PadGoodnessMask()) << endl;
497   cout << "Which means we reject pads having the condition = " <<
498   AliMUONPadStatusMaker::AsCondition(PadGoodnessMask()).Data() << endl;
499   
500   cout << "The pad limits we are using are :" << endl;
501   
502   for ( int ichamber = 0; ichamber < 10; ++ichamber ) 
503   {
504     cout << Form("HV Ch %d must be >= %5.2f",ichamber,HVLimit(ichamber)) << endl;
505   }
506
507   cout << Form("%7.2f <= Pedestal mean <= %7.2f",PedMeanLowLimit(),PedMeanHighLimit()) << endl;
508   cout << Form("%7.2f <= Pedestal sigma <= %7.2f",PedSigmaLowLimit(),PedSigmaHighLimit()) << endl;
509   cout << Form("%e <= Gain linear term <= %e",GainA1LowLimit(),GainA1HighLimit()) << endl;
510   cout << Form("%e <= Gain quadratic term <= %e",GainA2LowLimit(),GainA2HighLimit()) << endl;
511   cout << Form("%5.0f <= Gain threshold term <= %5.0f",GainThresLowLimit(),GainThresHighLimit()) << endl;
512     
513   cout << Form("And we cut on charge >= %7.2f x ( pedestal sigma ) ",ChargeSigmaCut()) << endl;
514   
515   cout << "Occupancy limits are :" << endl;
516   
517   cout << Form("%e <= Manu occupancy < %7.3f",ManuOccupancyLowLimit(),ManuOccupancyHighLimit()) << endl;
518   cout << Form("%e <= Buspatch occupancy < %7.3f",BuspatchOccupancyLowLimit(),BuspatchOccupancyHighLimit()) << endl;
519   cout << Form("%e <= DE occupancy < %7.3f",DEOccupancyLowLimit(),DEOccupancyHighLimit()) << endl;
520   
521   cout << "'QAChecker' limits" << endl;  
522   cout << Form("FractionOfBuspatchOutsideOccupancyLimit = %5.2f %%",FractionOfBuspatchOutsideOccupancyLimit()*100.0) << endl;
523   cout << Form("Event size limit = %5.2f KB/event (soft) and %5.2f KB/event (hard)",fEventSizeSoftLimit,fEventSizeHardLimit) << endl;
524   if ( fTokenLostLimit > 0 )
525   {
526     cout << Form("We tolerate up to %5.2f %% token lost errors per event",fTokenLostLimit) << endl;
527   }
528   else
529   {
530     cout << "We dot not tolerate any token lost error !" << endl;
531   }
532   
533   cout << "chamber non bending resolution = |";
534   for (Int_t iCh = 0; iCh < 10; iCh++) cout << Form(" %6.3f |",fDefaultNonBendingReso[iCh]);
535   cout << endl;
536   cout << "chamber bending resolution = |";
537   for (Int_t iCh = 0; iCh < 10; iCh++) cout << Form(" %6.3f |",fDefaultBendingReso[iCh]);
538   cout << endl;
539   cout<<Form("maximum number of trigger tracks above which the tracking is cancelled = %d",fMaxTriggerTracks)<<endl;
540   cout<<Form("maximum number of track candidates above which the tracking is abandonned = %d",fMaxTrackCandidates)<<endl;
541
542   cout << Form("The average noise pad charge is assumed to be %7.2f fC",AverageNoisePadCharge()) << endl;
543   cout << Form("and clusters below %5.2f times this noise charge (i.e. %7.2f fC) are discarded",
544                ClusterChargeCut(),ClusterChargeCut()*AverageNoisePadCharge()) << endl;
545   cout << Form("Note that LowestPadCharge is then %7.2f fC",LowestPadCharge()) << endl;
546   
547   if (strstr(option,"FULL")) {
548     cout<<"Try to improve the reconstructed tracks by changing the resolution of mono-cathod clusters: ";
549     if (fDiscardMonoCathodClusters) cout<<Form("ON (res = %6.3f, %6.3f)",fMonoCathodClNonBendingRes,fMonoCathodClBendingRes)<<endl;
550     else cout<<"OFF"<<endl;
551   } else if (fDiscardMonoCathodClusters)
552     cout<<Form("Try to improve the reconstructed tracks by changing the resolution of mono-cathod clusters (res = %6.3f, %6.3f)",
553                fMonoCathodClNonBendingRes,fMonoCathodClBendingRes)<<endl;
554   
555   if (TryRecover())
556   {
557     cout << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl;
558     cout << "!!! WILL TRY TO RECOVER CORRUPTED RAW DATA !!!" << endl;
559     cout << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl;    
560   }
561   cout<<"\t-----------------------------------------------------"<<endl<<endl;
562   
563 }
564
565 //_____________________________________________________________________________
566 void
567 AliMUONRecoParam::SetHVLimit(Int_t chamberId, Double_t value)
568 {
569   /// Set the HV limit for a given chamber (or all chambers 
570   /// if chamberId==-1
571   
572   if ( chamberId == -1 ) 
573   {
574     for ( Int_t i = 0; i < 10; ++i ) 
575     {
576       fHVLimit[i] = value;
577     }
578   }
579   else if ( chamberId >= 0 && chamberId < 10 ) 
580   {
581     fHVLimit[chamberId]=value;
582   }
583   else
584   {
585     AliError(Form("chamberId = %d is not a valid chamberId",chamberId));
586   }
587 }
588
589 //_____________________________________________________________________________
590 Double_t AliMUONRecoParam::HVLimit(Int_t chamberId) const
591 {
592   /// Get the HV limit for a given chamber
593   if ( chamberId >= 0 && chamberId < 10 )
594   {
595     return fHVLimit[chamberId];
596   }
597   AliError(Form("chamberId = %d is not a valid chamberId",chamberId));
598
599   return 0.0;
600 }
601
602 //_____________________________________________________________________________
603 void
604 AliMUONRecoParam::SetDefaultLimits()
605 {
606         /// Set the default limits and pad goodness policy
607
608   fHVSt12Limits[0]=1500; // kept for backward compatibility only
609         fHVSt12Limits[1]=2000; // kept for backward compatibility only
610         fHVSt345Limits[0]=1500; // kept for backward compatibility only
611         fHVSt345Limits[1]=2000; // kept for backward compatibility only
612   
613   SetHVLimit(-1,1590); // this one is the real HV limit used now
614   
615         fPedMeanLimits[0] = 20;
616         fPedMeanLimits[1] = 1024;
617         
618         fPedSigmaLimits[0] = 0.6;
619         fPedSigmaLimits[1] = 100;
620
621         fGainA1Limits[0] = 0.1;
622         fGainA1Limits[1] = 10;
623
624         fGainA2Limits[0] = -1E30;
625         fGainA2Limits[1] = 1E30;
626         
627         fGainThresLimits[0] = 0;
628         fGainThresLimits[1] = 4095;
629         
630         fPadGoodnessMask = 0x8080; // Ped is missing | HV is missing
631
632   fManuOccupancyLimits[0] = -1.0; 
633   fManuOccupancyLimits[1] = 1.0;
634
635   fBuspatchOccupancyLimits[0] = 1E-6; 
636   fBuspatchOccupancyLimits[1] = 1.0;
637
638   fDEOccupancyLimits[0] = -1.0; 
639   fDEOccupancyLimits[1] = 1.0;
640
641   fMissingPadFractionLimit = -1; // DEPRECATED
642   fFractionOfBuspatchOutsideOccupancyLimit = 0.05; // 5 % 
643
644   ChargeSigmaCut(4.0); // pad with charge < 4.0 x sigma will be removed (where sigma is the actual noise of that very pad, i.e. not the average)
645   
646   AverageNoisePadCharge(0.22875); // 0.22875 coulombs ~ 1.5 ADC channels
647
648   ClusterChargeCut(2.0); // will cut cluster below 2.0 x LowestPadCharge()
649   
650   SetEventSizeLimits(35.0,45.0);
651   
652   SetTokenLostLimit(0.0);
653   
654   fTryRecover = kFALSE;
655 }
656
657
658 //-----------------------------------------------------------------------
659 TObjArray* 
660 AliMUONRecoParam::Create(const char* settings)
661 {
662   /// Create pre-defined recoparam array, according to settings.
663   /// settings is case-insensitive.
664   ///
665   /// Currently defined are :
666   ///
667   /// "cosmics" :
668   ///      Cosmic (default)
669   ///      Calibration
670   /// "ppideal"
671   ///      LowFlux (default)
672   ///      Calibration
673   /// "ppreal"
674   ///      LowFlux (modified to reconstruct real p-p data)
675   ///      Calibration
676   /// "pprealsim"
677   ///      LowFlux (modified to reconstruct realistic p-p simulation)
678   ///      Calibration
679   /// "pbpbreal"
680   ///      HighFlux (modified to reconstruct real Pb-Pb data)
681   ///      Calibration
682   
683   AliMUONRecoParam* param(0x0);
684   
685   AliRecoParam::EventSpecie_t defaultParam = AliRecoParam::kLowMult;
686   
687   TString stype(settings);
688   stype.ToLower();
689   
690   if ( stype == "cosmics" )
691   {
692     // set parameters for cosmic runs
693     param = AliMUONRecoParam::GetCosmicParam();
694     defaultParam = AliRecoParam::kCosmic;
695   }
696   else if ( stype == "ppideal" ) 
697   {
698     // set default lowFlux parameters
699     param = AliMUONRecoParam::GetLowFluxParam();
700   }
701   else if ( stype == "ppreal" || stype == "pprealsim" || stype == "pprealnofield" ) 
702   {      
703     // common parameters for p-p data and realistic p-p simu
704     param = AliMUONRecoParam::GetLowFluxParam();
705     param->SaveFullClusterInESD(kTRUE, 100.);
706     for (Int_t iCh=0; iCh<10; iCh++) 
707     {
708       param->SetDefaultNonBendingReso(iCh,0.4);
709       param->SetDefaultBendingReso(iCh,0.4);
710     }
711     param->SetSigmaCutForTracking(7.);
712     param->SetStripCutForTrigger(1.5);
713     param->SetSigmaCutForTrigger(6.);
714     param->ImproveTracks(kTRUE, 6.);
715     param->SetPedMeanLimits(20, 700);
716     param->SetManuOccupancyLimits(-1.,0.015);
717     param->SetBuspatchOccupancyLimits(-1.,0.05);  
718     param->SetFractionOfBuspatchOutsideOccupancyLimit(0.05); // 5 %
719     param->SetEventSizeLimits(45., 65.);
720     param->SetHVLimit(0,1550);
721     param->SetHVLimit(1,1550);
722     param->SetHVLimit(2,1550);
723     param->SetHVLimit(3,1550);
724     
725     // specific parameters for p-p data or realistic p-p simu
726     if ( stype == "ppreal" || stype == "pprealnofield" )
727     {
728       param->SetPadGoodnessMask(0x400BE9B);
729     }
730     else
731     {
732       param->SetPadGoodnessMask(0x8080);      
733     }
734     
735     if ( stype == "pprealnofield" )
736     {
737       param->TryRecover(kTRUE);
738     }
739   }
740   else if ( stype == "pbpbreal" || stype == "pbpbrealsim" ) 
741   {      
742     // common parameters for Pb-Pb data and realistic Pb-Pb simu
743     param = AliMUONRecoParam::GetHighFluxParam();
744     defaultParam = AliRecoParam::kHighMult;
745     param->SaveFullClusterInESD(kTRUE, 100.);
746     for (Int_t iCh=0; iCh<10; iCh++) 
747     {
748       param->SetDefaultNonBendingReso(iCh,0.2);
749       param->SetDefaultBendingReso(iCh,0.2);
750     }
751     param->SetSigmaCutForTracking(5.);
752     param->SetStripCutForTrigger(1.5);
753     param->SetSigmaCutForTrigger(4.);
754     param->ImproveTracks(kTRUE, 4.);
755     param->SetPedMeanLimits(20, 700);
756     param->SetManuOccupancyLimits(-1.,0.03);
757     param->SetBuspatchOccupancyLimits(-1.,0.1); // 10 % (this cut not used for the reco anyway)
758     param->SetFractionOfBuspatchOutsideOccupancyLimit(0.05); // 5 %
759     param->SetEventSizeLimits(100., 150.);
760     
761     // specific parameters for Pb-Pb data or realistic Pb-Pb simu
762     if ( stype == "pbpbreal" )
763     {
764       param->SetPadGoodnessMask(0x400BE9B);
765     }
766     else
767     {
768       param->SetPadGoodnessMask(0x8080);      
769     }
770   }
771   else
772   {
773     AliErrorClass("Unknown settings !");
774     return 0x0;
775   }
776
777   TObjArray* recoParams = new TObjArray;
778
779   recoParams->AddLast(param);
780   
781   // set (dummy) parameters for calibration runs
782   param = AliMUONRecoParam::GetCalibrationParam();
783   recoParams->AddLast(param);
784   
785   // set parameters for Pb-Pb runs
786   // param = AliMUONRecoParam::GetHighFluxParam();
787   // recoParams.AddLast(param);
788   
789   // identify default parameters (exit if identification failed)
790   Bool_t defaultIsSet = kFALSE;
791   TIter next(recoParams);
792   while ( (param = static_cast<AliMUONRecoParam*>(next())) ) 
793   {
794     if (param->GetEventSpecie() == defaultParam) 
795     {
796       param->SetAsDefault();
797       defaultIsSet = kTRUE;
798     }
799     param->Print("FULL");
800   }
801   
802   if (!defaultIsSet) 
803   {
804     AliErrorClass("The default reconstruction parameters are not set! Exiting...");
805     return 0x0;
806   }  
807   
808   return recoParams;
809 }
810
811 //______________________________________________________________________________
812 void 
813 AliMUONRecoParam::Show(Int_t runNumber, const char* ocdb)
814 {
815   /// Show what we have in the designated OCDB for that run, as far as RecoParams are concerned
816   
817   AliCDBManager::Instance()->SetDefaultStorage(ocdb);
818   AliCDBManager::Instance()->SetRun(runNumber);
819   
820   AliCDBEntry* entry = AliCDBManager::Instance()->Get("MUON/Calib/RecoParam");
821   
822   if (!entry) return;
823   
824   TObject* o = entry->GetObject();
825   
826   if ( o->IsA() == TObjArray::Class() ) 
827   {
828     TObjArray* array = static_cast<TObjArray*>(o);
829     for ( Int_t i = 0; i <= array->GetLast(); ++i ) 
830     {
831       AliDetectorRecoParam* p = static_cast<AliDetectorRecoParam*>(array->At(i));
832       cout << Form("array[%d]=%s %s %s",i,
833                    p ? p->ClassName() : "",
834                    p ? AliRecoParam::GetEventSpecieName(AliRecoParam::Convert(p->GetEventSpecie())) :"",
835                    p ? ( p->IsDefault() ? "default" : "") : "" ) << endl;
836     }
837     cout << "=========== dumps below ====== " << endl;
838     
839     for ( Int_t i = 0; i <= array->GetLast(); ++i ) 
840     {
841       AliDetectorRecoParam* p = static_cast<AliDetectorRecoParam*>(array->At(i));
842       if ( p ) p->Print("");
843     }
844   }
845   else
846   {
847     o->Print();
848   }
849 }