1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 /////////////////////////////////////////////////////////////////////////////////
20 // AliTRDCalibraFillHisto
22 // This class is for the TRD calibration of the relative gain factor, the drift velocity,
23 // the time 0 and the pad response function. It fills histos or vectors.
24 // It can be used for the calibration per chamber but also per group of pads and eventually per pad.
25 // The user has to choose with the functions SetNz and SetNrphi the precision of the calibration (see AliTRDCalibraMode).
26 // 2D Histograms (Histo2d) or vectors (Vector2d), then converted in Trees, will be filled
27 // from RAW DATA in a run or from reconstructed TRD tracks during the offline tracking
28 // in the function "FollowBackProlongation" (AliTRDtracker)
29 // Per default the functions to fill are off.
32 // R. Bailhache (R.Bailhache@gsi.de)
34 //////////////////////////////////////////////////////////////////////////////////////
37 #include <TProfile2D.h>
43 #include <TGraphErrors.h>
44 #include <TObjArray.h>
49 #include <TStopwatch.h>
51 #include <TDirectory.h>
53 #include <TTreeStream.h>
58 #include "AliCDBManager.h"
60 #include "AliTRDCalibraFillHisto.h"
61 #include "AliTRDCalibraFit.h"
62 #include "AliTRDCalibraMode.h"
63 #include "AliTRDCalibraVector.h"
64 #include "AliTRDCalibraVdriftLinearFit.h"
65 #include "AliTRDcalibDB.h"
66 #include "AliTRDCommonParam.h"
67 #include "AliTRDmcmTracklet.h"
68 #include "AliTRDpadPlane.h"
69 #include "AliTRDcluster.h"
70 #include "AliTRDtrack.h"
71 #include "AliTRDRawStream.h"
72 #include "AliRawReader.h"
73 #include "AliRawReaderDate.h"
74 #include "AliTRDgeometry.h"
75 #include "./Cal/AliTRDCalROC.h"
76 #include "./Cal/AliTRDCalDet.h"
83 ClassImp(AliTRDCalibraFillHisto)
85 AliTRDCalibraFillHisto* AliTRDCalibraFillHisto::fgInstance = 0;
86 Bool_t AliTRDCalibraFillHisto::fgTerminated = kFALSE;
88 //_____________singleton implementation_________________________________________________
89 AliTRDCalibraFillHisto *AliTRDCalibraFillHisto::Instance()
92 // Singleton implementation
95 if (fgTerminated != kFALSE) {
99 if (fgInstance == 0) {
100 fgInstance = new AliTRDCalibraFillHisto();
107 //______________________________________________________________________________________
108 void AliTRDCalibraFillHisto::Terminate()
111 // Singleton implementation
112 // Deletes the instance of this class
115 fgTerminated = kTRUE;
117 if (fgInstance != 0) {
124 //______________________________________________________________________________________
125 AliTRDCalibraFillHisto::AliTRDCalibraFillHisto()
129 ,fMcmTracking(kFALSE)
130 ,fMcmCorrectAngle(kFALSE)
136 ,fLinearFitterOn(kFALSE)
137 ,fLinearFitterDebugOn(kFALSE)
139 ,fThresholdClusterPRF2(15.0)
140 ,fCalibraMode(new AliTRDCalibraMode())
143 ,fDetectorAliTRDtrack(kFALSE)
144 ,fDetectorPreviousTrack(-1)
151 ,fNumberBinCharge(100)
154 ,fListClusters(new TObjArray())
163 ,fGoodTracklet(kTRUE)
166 ,fEntriesLinearFitter(0x0)
171 ,fLinearFitterArray(540)
172 ,fLinearVdriftFit(0x0)
179 // Default constructor
183 // Init some default values
186 fNumberUsedCh[0] = 0;
187 fNumberUsedCh[1] = 0;
188 fNumberUsedPh[0] = 0;
189 fNumberUsedPh[1] = 0;
191 fGeo = new AliTRDgeometry();
195 //______________________________________________________________________________________
196 AliTRDCalibraFillHisto::AliTRDCalibraFillHisto(const AliTRDCalibraFillHisto &c)
199 ,fMITracking(c.fMITracking)
200 ,fMcmTracking(c.fMcmTracking)
201 ,fMcmCorrectAngle(c.fMcmCorrectAngle)
204 ,fPRF2dOn(c.fPRF2dOn)
205 ,fHisto2d(c.fHisto2d)
206 ,fVector2d(c.fVector2d)
207 ,fLinearFitterOn(c.fLinearFitterOn)
208 ,fLinearFitterDebugOn(c.fLinearFitterDebugOn)
209 ,fRelativeScale(c.fRelativeScale)
210 ,fThresholdClusterPRF2(c.fThresholdClusterPRF2)
213 ,fDebugLevel(c.fDebugLevel)
214 ,fDetectorAliTRDtrack(c.fDetectorAliTRDtrack)
215 ,fDetectorPreviousTrack(c.fDetectorPreviousTrack)
216 ,fNumberClusters(c.fNumberClusters)
217 ,fProcent(c.fProcent)
218 ,fDifference(c.fDifference)
219 ,fNumberTrack(c.fNumberTrack)
220 ,fTimeMax(c.fTimeMax)
222 ,fNumberBinCharge(c.fNumberBinCharge)
223 ,fNumberBinPRF(c.fNumberBinPRF)
224 ,fNgroupprf(c.fNgroupprf)
225 ,fListClusters(new TObjArray())
234 ,fGoodTracklet(c.fGoodTracklet)
235 ,fGoodTrack(c.fGoodTrack)
237 ,fEntriesLinearFitter(0x0)
242 ,fLinearFitterArray(540)
243 ,fLinearVdriftFit(0x0)
252 if(c.fCalibraMode) fCalibraMode = new AliTRDCalibraMode(*c.fCalibraMode);
253 if(c.fCalibraVector) fCalibraVector = new AliTRDCalibraVector(*c.fCalibraVector);
255 fPH2d = new TProfile2D(*c.fPH2d);
256 fPH2d->SetDirectory(0);
259 fPRF2d = new TProfile2D(*c.fPRF2d);
260 fPRF2d->SetDirectory(0);
263 fCH2d = new TH2I(*c.fCH2d);
264 fCH2d->SetDirectory(0);
266 if(c.fLinearVdriftFit){
267 fLinearVdriftFit = new AliTRDCalibraVdriftLinearFit(*c.fLinearVdriftFit);
270 if(c.fCalDetGain) fCalDetGain = new AliTRDCalDet(*c.fCalDetGain);
271 if(c.fCalDetT0) fCalDetT0 = new AliTRDCalDet(*c.fCalDetT0);
272 if(c.fCalROCGain) fCalROCGain = new AliTRDCalROC(*c.fCalROCGain);
273 if(c.fCalROCT0) fCalROCT0 = new AliTRDCalROC(*c.fCalROCT0);
278 fGeo = new AliTRDgeometry();
281 //____________________________________________________________________________________
282 AliTRDCalibraFillHisto::~AliTRDCalibraFillHisto()
285 // AliTRDCalibraFillHisto destructor
289 if ( fDebugStreamer ) delete fDebugStreamer;
291 if ( fCalDetGain ) delete fCalDetGain;
292 if ( fCalDetT0 ) delete fCalDetT0;
293 if ( fCalROCGain ) delete fCalROCGain;
294 if ( fCalROCT0 ) delete fCalROCT0;
302 //_____________________________________________________________________________
303 void AliTRDCalibraFillHisto::Destroy()
316 //_____________________________________________________________________________
317 void AliTRDCalibraFillHisto::ClearHistos()
338 //____________Functions for initialising the AliTRDCalibraFillHisto in the code_________
339 Bool_t AliTRDCalibraFillHisto::Init2Dhistos()
342 // For the offline tracking
343 // This function will be called in the function AliReconstruction::Run()
344 // Init the calibration mode (Nz, Nrphi), the 2D histograms if fHisto2d = kTRUE,
349 //Init the tracklet parameters
350 fPar0 = new Double_t[fTimeMax];
351 fPar1 = new Double_t[fTimeMax];
352 fPar2 = new Double_t[fTimeMax];
353 fPar3 = new Double_t[fTimeMax];
354 fPar4 = new Double_t[fTimeMax];
356 for(Int_t k = 0; k < fTimeMax; k++){
366 //____________Functions for initialising the AliTRDCalibraFillHisto in the code_________
367 Bool_t AliTRDCalibraFillHisto::Init2Dhistostrack()
370 // For the offline tracking
371 // This function will be called in the function AliReconstruction::Run()
372 // Init the calibration mode (Nz, Nrphi), the 2D histograms if fHisto2d = kTRUE,
377 AliTRDcalibDB *cal = AliTRDcalibDB::Instance();
379 AliInfo("Could not get calibDB");
382 AliTRDCommonParam *parCom = AliTRDCommonParam::Instance();
384 AliInfo("Could not get CommonParam");
389 fTimeMax = cal->GetNumberOfTimeBins();
390 fSf = parCom->GetSamplingFrequency();
393 //calib object from database used for reconstruction
394 if(fCalDetGain) delete fCalDetGain;
395 fCalDetGain = new AliTRDCalDet(*(cal->GetGainFactorDet()));
396 if(fCalDetT0) delete fCalDetT0;
397 fCalDetT0 = new AliTRDCalDet(*(cal->GetT0Det()));
399 // Calcul Xbins Chambd0, Chamb2
400 Int_t Ntotal0 = CalculateTotalNumberOfBins(0);
401 Int_t Ntotal1 = CalculateTotalNumberOfBins(1);
402 Int_t Ntotal2 = CalculateTotalNumberOfBins(2);
404 // If vector method On initialised all the stuff
406 fCalibraVector = new AliTRDCalibraVector();
407 fCalibraVector->SetNumberBinCharge(fNumberBinCharge);
408 fCalibraVector->SetTimeMax(fTimeMax);
409 if(fNgroupprf != 0) {
410 fCalibraVector->SetNumberBinPRF(2*fNgroupprf*fNumberBinPRF);
411 fCalibraVector->SetPRFRange((Float_t)(3.0*fNgroupprf));
414 fCalibraVector->SetNumberBinPRF(fNumberBinPRF);
415 fCalibraVector->SetPRFRange(1.5);
417 for(Int_t k = 0; k < 3; k++){
418 fCalibraVector->SetDetCha0(k,fCalibraMode->GetDetChamb0(k));
419 fCalibraVector->SetDetCha2(k,fCalibraMode->GetDetChamb2(k));
421 TString namech("Nz");
422 namech += fCalibraMode->GetNz(0);
424 namech += fCalibraMode->GetNrphi(0);
425 fCalibraVector->SetNameCH((const char* ) namech);
426 TString nameph("Nz");
427 nameph += fCalibraMode->GetNz(1);
429 nameph += fCalibraMode->GetNrphi(1);
430 fCalibraVector->SetNamePH((const char* ) nameph);
431 TString nameprf("Nz");
432 nameprf += fCalibraMode->GetNz(2);
434 nameprf += fCalibraMode->GetNrphi(2);
436 nameprf += fNgroupprf;
437 fCalibraVector->SetNamePRF((const char* ) nameprf);
440 // Create the 2D histos corresponding to the pad groupCalibration mode
443 AliInfo(Form("The pad calibration mode for the relative gain calibration: Nz %d, and Nrphi %d"
444 ,fCalibraMode->GetNz(0)
445 ,fCalibraMode->GetNrphi(0)));
447 // Create the 2D histo
452 fAmpTotal = new Float_t[TMath::Max(fCalibraMode->GetDetChamb2(0),fCalibraMode->GetDetChamb0(0))];
453 for (Int_t k = 0; k < TMath::Max(fCalibraMode->GetDetChamb2(0),fCalibraMode->GetDetChamb0(0)); k++) {
457 fEntriesCH = new Int_t[Ntotal0];
458 for(Int_t k = 0; k < Ntotal0; k++){
465 AliInfo(Form("The pad calibration mode for the drift velocity calibration: Nz %d, and Nrphi %d"
466 ,fCalibraMode->GetNz(1)
467 ,fCalibraMode->GetNrphi(1)));
469 // Create the 2D histo
474 fPHPlace = new Short_t[fTimeMax];
475 for (Int_t k = 0; k < fTimeMax; k++) {
478 fPHValue = new Float_t[fTimeMax];
479 for (Int_t k = 0; k < fTimeMax; k++) {
483 if (fLinearFitterOn) {
484 //fLinearFitterArray.Expand(540);
485 fLinearFitterArray.SetName("ArrayLinearFitters");
486 fEntriesLinearFitter = new Int_t[540];
487 for(Int_t k = 0; k < 540; k++){
488 fEntriesLinearFitter[k] = 0;
490 fLinearVdriftFit = new AliTRDCalibraVdriftLinearFit();
495 AliInfo(Form("The pad calibration mode for the PRF calibration: Nz %d, and Nrphi %d"
496 ,fCalibraMode->GetNz(2)
497 ,fCalibraMode->GetNrphi(2)));
498 // Create the 2D histo
500 CreatePRF2d(Ntotal2);
508 //____________Functions for filling the histos in the code_____________________
510 //____________Offine tracking in the AliTRDtracker_____________________________
511 Bool_t AliTRDCalibraFillHisto::ResetTrack()
514 // For the offline tracking
515 // This function will be called in the function
516 // AliTRDtracker::FollowBackPropagation() at the beginning
517 // Reset the parameter to know we have a new TRD track
520 fDetectorAliTRDtrack = kFALSE;
521 //fGoodTrack = kTRUE;
525 //____________Offine tracking in the AliTRDtracker_____________________________
526 void AliTRDCalibraFillHisto::ResetfVariables()
529 // Reset values per tracklet
532 // Reset the list of clusters
533 fListClusters->Clear();
535 //Reset the tracklet parameters
536 for(Int_t k = 0; k < fTimeMax; k++){
544 ResetfVariablestrack();
547 //____________Offine tracking in the AliTRDtracker_____________________________
548 void AliTRDCalibraFillHisto::ResetfVariablestrack()
551 // Reset values per tracklet
554 //Reset good tracklet
555 fGoodTracklet = kTRUE;
557 // Reset the fPHValue
559 //Reset the fPHValue and fPHPlace
560 for (Int_t k = 0; k < fTimeMax; k++) {
566 // Reset the fAmpTotal where we put value
568 for (Int_t k = 0; k < fCalibraMode->GetNfragZ(0)*fCalibraMode->GetNfragRphi(0); k++) {
573 //____________Offline tracking in the AliTRDtracker____________________________
574 Bool_t AliTRDCalibraFillHisto::UpdateHistograms(AliTRDtrack *t)
577 // For the offline tracking
578 // This function will be called in the function
579 // AliTRDtracker::FollowBackPropagation() in the loop over the clusters
581 // Fill the 2D histos or the vectors with the info of the clusters at
582 // the end of a detectors if the track is "good"
587 AliTRDcluster *cl = 0x0;
591 // reset if good track
595 // loop over the clusters
596 while((cl = t->GetCluster(index1))){
598 // Localisation of the detector
599 Int_t detector = cl->GetDetector();
602 // Fill the infos for the previous clusters if not the same
603 // detector anymore but this time it should be the same track
604 if ((detector != fDetectorPreviousTrack) &&
605 (index0 != index1)) {
609 //printf("detector %d, fPreviousdetector %d, plane %d, planeprevious %d, index0 %d, index1 %d la\n",detector,fDetectorPreviousTrack,GetPlane(detector),GetPlane(fDetectorPreviousTrack),index0,index1);
611 //If the same track, then look if the previous detector is in
612 //the same plane, if yes: not a good track
614 //if (fDetectorAliTRDtrack &&
615 // (GetPlane(detector) <= GetPlane(fDetectorPreviousTrack))) {
617 if ((GetPlane(detector) >= GetPlane(fDetectorPreviousTrack))) {
621 // Fill only if the track doesn't touch a masked pad or doesn't
622 // appear in the middle (fGoodTrack)
623 if (fGoodTrack && fGoodTracklet) {
625 // drift velocity unables to cut bad tracklets
626 Bool_t pass = FindP1TrackPHtrack(t,index0,index1);
630 FillTheInfoOfTheTrackCH();
635 FillTheInfoOfTheTrackPH();
638 if(pass && fPRF2dOn) HandlePRFtrack(t,index0,index1);
644 ResetfVariablestrack();
647 } // Fill at the end the charge
649 // Calcul the position of the detector and take the calib objects
650 if (detector != fDetectorPreviousTrack) {
652 //Localise the detector
653 LocalisationDetectorXbins(detector);
656 AliTRDcalibDB *cal = AliTRDcalibDB::Instance();
658 AliInfo("Could not get calibDB");
663 if( fCalROCGain ) delete fCalROCGain;
664 fCalROCGain = new AliTRDCalROC(*(cal->GetGainFactorROC(detector)));
665 if( fCalROCT0 ) delete fCalROCT0;
666 fCalROCT0 = new AliTRDCalROC(*(cal->GetT0ROC(detector)));
670 // Reset the detectbjobsor
671 fDetectorPreviousTrack = detector;
673 // Store the info bis of the tracklet
674 Int_t *rowcol = CalculateRowCol(cl);
675 CheckGoodTracklet(detector,rowcol);
676 Int_t group[2] = {0,0};
677 if(fCH2dOn) group[0] = CalculateCalibrationGroup(0,rowcol);
678 if(fPH2dOn) group[1] = CalculateCalibrationGroup(1,rowcol);
679 StoreInfoCHPHtrack(cl,t,index1,group,rowcol);
683 } // while on clusters
685 // Fill the last plane
686 if( index0 != index1 ){
688 //printf("fPreviousdetector %d, planeprevious %d, index0 %d, index1 %d li\n",fDetectorPreviousTrack,GetPlane(fDetectorPreviousTrack),index0,index1);
692 if (fGoodTrack && fGoodTracklet) {
694 // drift velocity unables to cut bad tracklets
695 Bool_t pass = FindP1TrackPHtrack(t,index0,index1);
699 FillTheInfoOfTheTrackCH();
704 FillTheInfoOfTheTrackPH();
707 if(pass && fPRF2dOn) HandlePRFtrack(t,index0,index1);
714 ResetfVariablestrack();
719 //____________Offline tracking in the AliTRDtracker____________________________
720 Bool_t AliTRDCalibraFillHisto::UpdateHistograms(AliTRDcluster *cl, AliTRDtrack *t)
723 // For the offline tracking
724 // This function will be called in the function
725 // AliTRDtracker::FollowBackPropagation() in the loop over the clusters
727 // Fill the 2D histos or the vectors with the info of the clusters at
728 // the end of a detectors if the track is "good"
731 // Localisation of the detector
732 Int_t detector = cl->GetDetector();
734 // Fill the infos for the previous clusters if not the same
735 // detector anymore or if not the same track
736 if (((detector != fDetectorPreviousTrack) || (!fDetectorAliTRDtrack)) &&
737 (fDetectorPreviousTrack != -1)) {
741 // If the same track, then look if the previous detector is in
742 // the same plane, if yes: not a good track
744 if (fDetectorAliTRDtrack &&
745 (GetPlane(detector) <= GetPlane(fDetectorPreviousTrack))) {
747 //if (fDetectorAliTRDtrack &&
748 // (GetPlane(detector) >= GetPlane(fDetectorPreviousTrack))) {
752 // Fill only if the track doesn't touch a masked pad or doesn't
753 // appear in the middle (fGoodTrack)
754 if (fGoodTrack && fGoodTracklet) {
756 // drift velocity unables to cut bad tracklets
757 Bool_t pass = FindP1TrackPH();
761 FillTheInfoOfTheTrackCH();
766 FillTheInfoOfTheTrackPH();
769 if(pass && fPRF2dOn) HandlePRF();
775 if(!fDetectorAliTRDtrack) fGoodTrack = kTRUE;
777 } // Fill at the end the charge
779 // Calcul the position of the detector and take the calib objects
780 if (detector != fDetectorPreviousTrack) {
781 //Localise the detector
782 LocalisationDetectorXbins(detector);
785 AliTRDcalibDB *cal = AliTRDcalibDB::Instance();
787 AliInfo("Could not get calibDB");
792 if( fCalROCGain ) delete fCalROCGain;
793 fCalROCGain = new AliTRDCalROC(*(cal->GetGainFactorROC(detector)));
794 if( fCalROCT0 ) delete fCalROCT0;
795 fCalROCT0 = new AliTRDCalROC(*(cal->GetT0ROC(detector)));
798 // Reset the detector
799 fDetectorPreviousTrack = detector;
800 fDetectorAliTRDtrack = kTRUE;
802 // Store the infos of the tracklets
803 AliTRDcluster *kcl = new AliTRDcluster(*cl);
804 fListClusters->Add((TObject *)kcl);
805 Int_t time = cl->GetLocalTimeBin();
806 fPar0[time] = t->GetY();
807 fPar1[time] = t->GetZ();
808 fPar2[time] = t->GetSnp();
809 fPar3[time] = t->GetTgl();
810 fPar4[time] = t->Get1Pt();
812 // Store the info bis of the tracklet
813 Int_t *rowcol = CalculateRowCol(cl);
814 CheckGoodTracklet(detector,rowcol);
815 Int_t group[2] = {0,0};
816 if(fCH2dOn) group[0] = CalculateCalibrationGroup(0,rowcol);
817 if(fPH2dOn) group[1] = CalculateCalibrationGroup(1,rowcol);
818 StoreInfoCHPH(cl,t,group,rowcol);
823 //____________Online trackling in AliTRDtrigger________________________________
824 Bool_t AliTRDCalibraFillHisto::UpdateHistogramcm(AliTRDmcmTracklet *trk)
828 // This function will be called in the function AliTRDtrigger::TestTracklet
829 // before applying the pt cut on the tracklets
830 // Fill the infos for the tracklets fTrkTest if the tracklets is "good"
833 // Localisation of the Xbins involved
834 Int_t idect = trk->GetDetector();
835 fDetectorPreviousTrack = idect;
836 LocalisationDetectorXbins(idect);
838 // Get the parameter object
839 AliTRDcalibDB *cal = AliTRDcalibDB::Instance();
841 AliInfo("Could not get calibDB");
849 if( fCalROCGain ) delete fCalROCGain;
850 fCalROCGain = new AliTRDCalROC(*(cal->GetGainFactorROC(idect)));
851 if( fCalROCT0 ) delete fCalROCT0;
852 fCalROCT0 = new AliTRDCalROC(*(cal->GetT0ROC(idect)));
854 // Row of the tracklet and position in the pad groups
855 Int_t *rowcol = new Int_t[2];
856 rowcol[0] = trk->GetRow();
857 Int_t group[3] = {-1,-1,-1};
859 // Eventuelle correction due to track angle in z direction
860 Float_t correction = 1.0;
861 if (fMcmCorrectAngle) {
862 Float_t z = trk->GetRowz();
863 Float_t r = trk->GetTime0();
864 correction = r / TMath::Sqrt((r*r+z*z));
867 // Boucle sur les clusters
868 // Condition on number of cluster: don't come from the middle of the detector
869 if (trk->GetNclusters() >= fNumberClusters) {
871 for (Int_t icl = 0; icl < trk->GetNclusters(); icl++) {
873 Float_t amp[3] = { 0.0, 0.0, 0.0 };
874 Int_t time = trk->GetClusterTime(icl);
875 rowcol[1] = trk->GetClusterCol(icl);
877 amp[0] = trk->GetClusterADC(icl)[0] * correction;
878 amp[1] = trk->GetClusterADC(icl)[1] * correction;
879 amp[2] = trk->GetClusterADC(icl)[2] * correction;
882 if ((amp[0] < 0.0) ||
888 // Col of cluster and position in the pad groups
890 group[0] = CalculateCalibrationGroup(0,rowcol);
891 fAmpTotal[(Int_t) group[0]] += (Float_t) (amp[0]+amp[1]+amp[2]);
894 group[1] = CalculateCalibrationGroup(1,rowcol);
895 fPHPlace[time] = group[1];
896 fPHValue[time] = (Float_t) (amp[0]+amp[1]+amp[2]);
898 if(fPRF2dOn) group[2] = CalculateCalibrationGroup(2,rowcol);
900 // See if we are not near a masked pad fGoodTracklet
901 CheckGoodTracklet(idect,rowcol);
903 // Fill PRF direct without tnp bins...only for monitoring...
904 if (fPRF2dOn && fGoodTracklet) {
906 if ((amp[0] > fThresholdClusterPRF2) &&
907 (amp[1] > fThresholdClusterPRF2) &&
908 (amp[2] > fThresholdClusterPRF2) &&
909 ((amp[0]*amp[2]/(amp[1]*amp[1])) < 0.06)) {
911 // Security of the denomiateur is 0
912 if ((((Float_t) (((Float_t) amp[1]) * ((Float_t) amp[1])))
913 / ((Float_t) (((Float_t) amp[0]) * ((Float_t) amp[2])))) != 1.0) {
914 Float_t xcenter = 0.5 * (TMath::Log(amp[2] / amp[0]))
915 / (TMath::Log((amp[1]*amp[1]) / (amp[0]*amp[2])));
916 Float_t ycenter = amp[1] / (amp[0] + amp[1] + amp[2]);
918 if (TMath::Abs(xcenter) < 0.5) {
919 Float_t yminus = amp[0] / (amp[0]+amp[1]+amp[2]);
920 Float_t ymax = amp[2] / (amp[0]+amp[1]+amp[2]);
921 // Fill only if it is in the drift region!
922 if (((Float_t) time / fSf) > 0.3) {
924 fPRF2d->Fill(xcenter,(fCalibraMode->GetXbins(2)+group[2]+0.5),ycenter);
925 fPRF2d->Fill(-(xcenter+1.0),(fCalibraMode->GetXbins(2)+group[2]+0.5),yminus);
926 fPRF2d->Fill((1.0-xcenter),(fCalibraMode->GetXbins(2)+group[2]+0.5),ymax);
929 fCalibraVector->UpdateVectorPRF(idect,group[2],xcenter,ycenter);
930 fCalibraVector->UpdateVectorPRF(idect,group[2],-(xcenter+1.0),yminus);
931 fCalibraVector->UpdateVectorPRF(idect,group[2],(1.0-xcenter),ymax);
933 }//in the drift region
935 }//denominateur security
936 }//cluster shape and thresholds
943 if (fCH2dOn) FillTheInfoOfTheTrackCH();
944 if (fPH2dOn) FillTheInfoOfTheTrackPH();
949 } // Condition on number of clusters
954 //_____________________________________________________________________________
955 Int_t *AliTRDCalibraFillHisto::CalculateRowCol(AliTRDcluster *cl) const
958 // Calculate the row and col number of the cluster
962 Int_t *rowcol = new Int_t[2];
966 // Localisation of the detector
967 Int_t detector = cl->GetDetector();
968 Int_t chamber = GetChamber(detector);
969 Int_t plane = GetPlane(detector);
971 // Localisation of the cluster
972 Double_t pos[3] = { 0.0, 0.0, 0.0 };
973 pos[0] = ((AliCluster *)cl)->GetX();
977 // Position of the cluster
978 AliTRDpadPlane *padplane = fGeo->GetPadPlane(plane,chamber);
979 Int_t row = padplane->GetPadRowNumber(pos[2]);
980 //Do not take from here because it was corrected from ExB already....
981 //Double_t offsetz = padplane->GetPadRowOffset(row,pos[2]);
982 //Double_t offsettilt = padplane->GetTiltOffset(offsetz);
983 //Int_t col = padplane->GetPadColNumber(pos[1] + offsettilt,offsetz);
984 //Int_t col = padplane->GetPadColNumber(pos[1]+offsettilt);
985 Int_t col = cl->GetPad();
993 //_____________________________________________________________________________
994 void AliTRDCalibraFillHisto::CheckGoodTracklet(Int_t detector, Int_t *rowcol)
997 // See if we are not near a masked pad
1000 Int_t row = rowcol[0];
1001 Int_t col = rowcol[1];
1003 if (!IsPadOn(detector, col, row)) {
1004 fGoodTracklet = kFALSE;
1008 if (!IsPadOn(detector, col-1, row)) {
1009 fGoodTracklet = kFALSE;
1014 if (!IsPadOn(detector, col+1, row)) {
1015 fGoodTracklet = kFALSE;
1020 //_____________________________________________________________________________
1021 Bool_t AliTRDCalibraFillHisto::IsPadOn(Int_t detector, Int_t col, Int_t row) const
1024 // Look in the choosen database if the pad is On.
1025 // If no the track will be "not good"
1028 // Get the parameter object
1029 AliTRDcalibDB *cal = AliTRDcalibDB::Instance();
1031 AliInfo("Could not get calibDB");
1035 if (!cal->IsChamberInstalled(detector) ||
1036 cal->IsChamberMasked(detector) ||
1037 cal->IsPadMasked(detector,col,row)) {
1045 //_____________________________________________________________________________
1046 Int_t AliTRDCalibraFillHisto::CalculateCalibrationGroup(Int_t i, Int_t *rowcol) const
1049 // Calculate the calibration group number for i
1052 // Row of the cluster and position in the pad groups
1054 if (fCalibraMode->GetNnZ(i) != 0) {
1055 posr = (Int_t) rowcol[0] / fCalibraMode->GetNnZ(i);
1059 // Col of the cluster and position in the pad groups
1061 if (fCalibraMode->GetNnRphi(i) != 0) {
1062 posc = (Int_t) rowcol[1] / fCalibraMode->GetNnRphi(i);
1065 return posc*fCalibraMode->GetNfragZ(i)+posr;
1068 //____________________________________________________________________________________
1069 Int_t AliTRDCalibraFillHisto::CalculateTotalNumberOfBins(Int_t i)
1072 // Calculate the total number of calibration groups
1076 fCalibraMode->ModePadCalibration(2,i);
1077 fCalibraMode->ModePadFragmentation(0,2,0,i);
1078 fCalibraMode->SetDetChamb2(i);
1079 Ntotal += 6 * 18 * fCalibraMode->GetDetChamb2(i);
1080 fCalibraMode->ModePadCalibration(0,i);
1081 fCalibraMode->ModePadFragmentation(0,0,0,i);
1082 fCalibraMode->SetDetChamb0(i);
1083 Ntotal += 6 * 4 * 18 * fCalibraMode->GetDetChamb0(i);
1084 AliInfo(Form("Total number of Xbins: %d for i %d",Ntotal,i));
1088 //____________Set the pad calibration variables for the detector_______________
1089 Bool_t AliTRDCalibraFillHisto::LocalisationDetectorXbins(Int_t detector)
1092 // For the detector calcul the first Xbins and set the number of row
1093 // and col pads per calibration groups, the number of calibration
1094 // groups in the detector.
1097 // first Xbins of the detector
1099 fCalibraMode->CalculXBins(detector,0);
1102 fCalibraMode->CalculXBins(detector,1);
1105 fCalibraMode->CalculXBins(detector,2);
1108 // fragmentation of idect
1109 for (Int_t i = 0; i < 3; i++) {
1110 fCalibraMode->ModePadCalibration((Int_t) GetChamber(detector),i);
1111 fCalibraMode->ModePadFragmentation((Int_t) GetPlane(detector)
1112 , (Int_t) GetChamber(detector)
1113 , (Int_t) GetSector(detector),i);
1119 //_____________________________________________________________________________
1120 void AliTRDCalibraFillHisto::StoreInfoCHPH(AliTRDcluster *cl, AliTRDtrack *t, Int_t *group, Int_t *rowcol)
1123 // Store the infos in fAmpTotal, fPHPlace and fPHValue
1126 // Charge in the cluster
1127 Float_t q = TMath::Abs(cl->GetQ());
1128 Int_t time = cl->GetLocalTimeBin();
1130 //Correct for the gain coefficient used in the database for reconstruction
1131 Float_t correctthegain = fCalDetGain->GetValue(fDetectorPreviousTrack)*fCalROCGain->GetValue(rowcol[1],rowcol[0]);
1132 Float_t correcttheT0 = fCalDetT0->GetValue(fDetectorPreviousTrack)+fCalROCT0->GetValue(rowcol[1],rowcol[0]);
1134 // we substract correcttheT0 in AliTRDclusterizerV1::MakeClusters (line 458)
1135 Int_t timec = Arrondi((Double_t)(time+correcttheT0));
1136 if((correcttheT0+0.5)==(int(correcttheT0+0.5))) {
1139 if( timec < 0 ) return;
1142 // Correction due to the track angle
1143 Float_t correction = 1.0;
1144 Float_t normalisation = 6.67;
1145 // we divide with gain in AliTRDclusterizerV1::Transform...
1146 if( correctthegain > 0 ) normalisation /= correctthegain;
1147 if ((q >0) && (t->GetNdedx() > 0)) {
1148 correction = t->GetClusterdQdl((t->GetNdedx() - 1)) / (normalisation);
1151 // Fill the fAmpTotal with the charge
1153 fAmpTotal[(Int_t) group[0]] += correction;
1156 // Fill the fPHPlace and value
1158 fPHPlace[timec] = group[1];
1159 fPHValue[timec] = correction;
1163 //_____________________________________________________________________________
1164 void AliTRDCalibraFillHisto::StoreInfoCHPHtrack(AliTRDcluster *cl, AliTRDtrack *t, Int_t index, Int_t *group, Int_t *rowcol)
1167 // Store the infos in fAmpTotal, fPHPlace and fPHValue
1170 // Charge in the cluster
1171 Float_t q = TMath::Abs(cl->GetQ());
1172 Int_t time = cl->GetLocalTimeBin();
1174 //Correct for the gain coefficient used in the database for reconstruction
1175 Float_t correctthegain = fCalDetGain->GetValue(fDetectorPreviousTrack)*fCalROCGain->GetValue(rowcol[1],rowcol[0]);
1176 Float_t correcttheT0 = fCalDetT0->GetValue(fDetectorPreviousTrack)+fCalROCT0->GetValue(rowcol[1],rowcol[0]);
1178 // we substract correcttheT0 in AliTRDclusterizerV1::MakeClusters (line 458)
1179 Int_t timec = Arrondi((Double_t)(time+correcttheT0));
1180 if((correcttheT0+0.5)==(int(correcttheT0+0.5))) {
1183 if( timec < 0 ) return;
1185 // Correction due to the track angle
1186 Float_t correction = 1.0;
1187 Float_t normalisation = 6.67;
1188 // we divide with gain in AliTRDclusterizerV1::Transform...
1189 if( correctthegain > 0 ) normalisation /= correctthegain;
1191 correction = t->GetClusterdQdl(index) / (normalisation);
1194 // Fill the fAmpTotal with the charge
1196 fAmpTotal[(Int_t) group[0]] += correction;
1199 // Fill the fPHPlace and value
1201 fPHPlace[timec] = group[1];
1202 fPHValue[timec] = correction;
1206 //_____________________________________________________________________
1207 Int_t AliTRDCalibraFillHisto::ProcessEventDAQ(AliTRDRawStream *rawStream, Bool_t nocheck)
1210 // Event Processing loop - AliTRDRawStream
1211 // 0 timebin problem
1216 Int_t withInput = 1;
1221 for(Int_t k = 0; k < 36; k++){
1226 fDetectorPreviousTrack = -1;
1227 Int_t nbtimebin = 0;
1233 while (rawStream->Next()) {
1235 Int_t idetector = rawStream->GetDet(); // current detector
1236 if((fDetectorPreviousTrack != idetector) && (fDetectorPreviousTrack != -1)){
1237 if(TMath::Mean(fTimeMax,phvalue)>20.0){
1239 for(Int_t k = 0; k < fTimeMax; k++){
1240 UpdateDAQ(fDetectorPreviousTrack,0,0,k,phvalue[k],fTimeMax);
1247 fDetectorPreviousTrack = idetector;
1248 nbtimebin = rawStream->GetNumberOfTimeBins(); // number of time bins read from data
1249 if(nbtimebin == 0) return 0;
1250 if((fTimeMax != 0) && (nbtimebin != fTimeMax)) return 0;
1251 fTimeMax = nbtimebin;
1252 Int_t iTimeBin = rawStream->GetTimeBin(); // current time bin
1253 //row[iTimeBin] = rawStream->GetRow(); // current row
1254 //col[iTimeBin] = rawStream->GetCol(); // current col
1255 Int_t *signal = rawStream->GetSignals(); // current ADC signal
1257 Int_t fin = TMath::Min(fTimeMax,(iTimeBin+3));
1259 for(Int_t itime = iTimeBin; itime < fin; itime++){
1260 // should extract baseline here!
1261 if(signal[n]>13) phvalue[itime] = signal[n];
1266 // fill the last one
1267 if(fDetectorPreviousTrack != -1){
1268 if(TMath::Mean(fTimeMax,phvalue)>20.0){
1270 for(Int_t k = 0; k < fTimeMax; k++){
1271 UpdateDAQ(fDetectorPreviousTrack,0,0,k,phvalue[k],fTimeMax);
1282 while (rawStream->Next()) {
1284 Int_t idetector = rawStream->GetDet(); // current detector
1285 if((fDetectorPreviousTrack != idetector) && (fDetectorPreviousTrack != -1)){
1286 if(TMath::Mean(nbtimebin,phvalue)>20.0){
1288 for(Int_t k = 0; k < nbtimebin; k++){
1289 UpdateDAQ(fDetectorPreviousTrack,0,0,k,phvalue[k],nbtimebin);
1296 fDetectorPreviousTrack = idetector;
1297 nbtimebin = rawStream->GetNumberOfTimeBins(); // number of time bins read from data
1298 Int_t iTimeBin = rawStream->GetTimeBin(); // current time bin
1299 //row[iTimeBin] = rawStream->GetRow(); // current row
1300 //col[iTimeBin] = rawStream->GetCol(); // current col
1301 Int_t *signal = rawStream->GetSignals(); // current ADC signal
1303 Int_t fin = TMath::Min(nbtimebin,(iTimeBin+3));
1305 for(Int_t itime = iTimeBin; itime < fin; itime++){
1306 // should extract baseline here!
1307 if(signal[n]>13) phvalue[itime] = signal[n];
1312 // fill the last one
1313 if(fDetectorPreviousTrack != -1){
1314 if(TMath::Mean(nbtimebin,phvalue)>20.0){
1316 for(Int_t k = 0; k < nbtimebin; k++){
1317 UpdateDAQ(fDetectorPreviousTrack,0,0,k,phvalue[k],nbtimebin);
1329 //_____________________________________________________________________
1330 Int_t AliTRDCalibraFillHisto::ProcessEventDAQ(AliRawReader *rawReader, Bool_t nocheck)
1333 // Event processing loop - AliRawReader
1337 AliTRDRawStream rawStream(rawReader);
1339 rawReader->Select("TRD");
1341 return ProcessEventDAQ(&rawStream, nocheck);
1343 //_________________________________________________________________________
1344 Int_t AliTRDCalibraFillHisto::ProcessEventDAQ(
1346 eventHeaderStruct *event,
1349 eventHeaderStruct* /*event*/,
1356 // process date event
1359 AliRawReader *rawReader = new AliRawReaderDate((void*)event);
1360 Int_t result=ProcessEventDAQ(rawReader, nocheck);
1364 Fatal("AliTRDCalibraFillHisto", "this class was compiled without DATE");
1369 //____________Online trackling in AliTRDtrigger________________________________
1370 Bool_t AliTRDCalibraFillHisto::UpdateDAQ(Int_t det, Int_t /*row*/, Int_t /*col*/, Int_t timebin, Int_t signal, Int_t nbtimebins)
1374 // Fill a simple average pulse height
1377 // Localisation of the Xbins involved
1378 //LocalisationDetectorXbins(det);
1380 // Row and position in the pad groups
1382 //if (fCalibraMode->GetNnZ(1) != 0) {
1383 // posr = (Int_t) row / fCalibraMode->GetNnZ(1);
1386 // Col of cluster and position in the pad groups
1388 //if (fCalibraMode->GetNnRphi(1) != 0) {
1389 // posc = (Int_t) col / fCalibraMode->GetNnRphi(1);
1392 //fPH2d->Fill((Float_t) timebin/fSf,(fCalibraMode->GetXbins(1)+posc*fCalibraMode->GetNfragZ(1)+posr)+0.5,(Float_t) signal);
1394 ((TProfile2D *)GetPH2d(nbtimebins,fSf))->Fill((Float_t) timebin/fSf,det+0.5,(Float_t) signal);
1399 //____________Write_____________________________________________________
1400 //_____________________________________________________________________
1401 void AliTRDCalibraFillHisto::Write2d(const Char_t *filename, Bool_t append)
1404 // Write infos to file
1408 if ( fDebugStreamer ) {
1409 delete fDebugStreamer;
1410 fDebugStreamer = 0x0;
1413 AliInfo(Form("Numbertrack: %d Numberusedch[0]: %d, Numberusedch[1]: %d Numberusedph[0]: %d, Numberusedph[1]: %d"
1418 ,fNumberUsedPh[1]));
1420 TDirectory *backup = gDirectory;
1426 option = "recreate";
1428 TFile f(filename,option.Data());
1430 TStopwatch stopwatch;
1433 f.WriteTObject(fCalibraVector);
1438 f.WriteTObject(fCH2d);
1443 f.WriteTObject(fPH2d);
1448 f.WriteTObject(fPRF2d);
1451 if(fLinearFitterOn){
1452 AnalyseLinearFitter();
1453 f.WriteTObject(fLinearVdriftFit);
1458 if ( backup ) backup->cd();
1460 AliInfo(Form("Execution time Write2d: R:%.2fs C:%.2fs"
1461 ,stopwatch.RealTime(),stopwatch.CpuTime()));
1463 //___________________________________________probe the histos__________________________________________________
1464 Double_t *AliTRDCalibraFillHisto::StatH(TH2 *h, Int_t i)
1467 // Check the number of stats in h, 0 is TH2I 1 is TProfile2D
1468 // debug mode with 2 for TH2I and 3 for TProfile2D
1469 // It gives a pointer to a Double_t[7] with the info following...
1470 // [0] : number of calibration groups with entries
1471 // [1] : minimal number of entries found
1472 // [2] : calibration group number of the min
1473 // [3] : maximal number of entries found
1474 // [4] : calibration group number of the max
1475 // [5] : mean number of entries found
1476 // [6] : mean relative error
1479 Double_t *info = new Double_t[7];
1481 // Number of Xbins (detectors or groups of pads)
1482 Int_t nbins = h->GetNbinsY(); //number of calibration groups
1483 Int_t nxbins = h->GetNbinsX(); //number of bins per histo
1486 Double_t nbwe = 0; //number of calibration groups with entries
1487 Double_t minentries = 0; //minimal number of entries found
1488 Double_t maxentries = 0; //maximal number of entries found
1489 Double_t placemin = 0; //calibration group number of the min
1490 Double_t placemax = -1; //calibration group number of the max
1491 Double_t meanstats = 0.0; //mean number of entries over the calibration group with at least ome entry
1492 Double_t meanrelativerror = 0.0; //mean relativ error in the TProfile2D
1494 Double_t counter = 0;
1497 TH1F *NbEntries = 0x0;//distribution of the number of entries
1498 TH1F *NbEntriesPerGroup = 0x0;//Number of entries per group
1499 TProfile *NbEntriesPerSp = 0x0;//Number of entries for one supermodule
1501 // Beginning of the loop over the calibration groups
1502 for (Int_t idect = 0; idect < nbins; idect++) {
1504 TH1I *projch = (TH1I *) h->ProjectionX("projch",idect+1,idect+1,(Option_t *)"e");
1505 projch->SetDirectory(0);
1507 // Number of entries for this calibration group
1508 Double_t nentries = 0.0;
1510 for (Int_t k = 0; k < nxbins; k++) {
1511 nentries += h->GetBinContent(h->GetBin(k+1,idect+1));
1515 for (Int_t k = 0; k < nxbins; k++) {
1516 nentries += ((TProfile2D *)h)->GetBinEntries(h->GetBin(k+1,idect+1));
1517 if(h->GetBinContent(h->GetBin(k+1,idect+1)) != 0) {
1518 meanrelativerror += (h->GetBinError(h->GetBin(k+1,idect+1))/(TMath::Abs(h->GetBinContent(h->GetBin(k+1,idect+1)))));
1526 if((!((Bool_t)NbEntries)) && (nentries > 0)){
1527 NbEntries = new TH1F("Number of entries","Number of entries"
1528 ,100,(Int_t)nentries/2,nentries*2);
1529 NbEntries->SetDirectory(0);
1530 NbEntriesPerGroup = new TH1F("Number of entries per group","Number of entries per group"
1532 NbEntriesPerGroup->SetDirectory(0);
1533 NbEntriesPerSp = new TProfile("Number of entries per supermodule","Number of entries per supermodule"
1534 ,(Int_t)(nbins/18),0,(Int_t)(nbins/18));
1535 NbEntriesPerSp->SetDirectory(0);
1538 if(nentries > 0) NbEntries->Fill(nentries);
1539 NbEntriesPerGroup->Fill(idect+0.5,nentries);
1540 NbEntriesPerSp->Fill((idect%((Int_t)(nbins/18)))+0.5,nentries);
1545 if(nentries > maxentries){
1546 maxentries = nentries;
1550 minentries = nentries;
1552 if(nentries < minentries){
1553 minentries = nentries;
1559 meanstats += nentries;
1561 }//calibration groups loop
1563 if(nbwe > 0) meanstats /= nbwe;
1564 if(counter > 0) meanrelativerror /= counter;
1566 AliInfo(Form("There are %f calibration groups with entries",nbwe));
1567 AliInfo(Form("The minimum number of entries is %f for the group %f",minentries,placemin));
1568 AliInfo(Form("The maximum number of entries is %f for the group %f",maxentries,placemax));
1569 AliInfo(Form("The mean number of entries is %f",meanstats));
1570 if((i%2) == 1) AliInfo(Form("The mean relative error is %f",meanrelativerror));
1573 info[1] = minentries;
1575 info[3] = maxentries;
1577 info[5] = meanstats;
1578 info[6] = meanrelativerror;
1581 gStyle->SetPalette(1);
1582 gStyle->SetOptStat(1111);
1583 gStyle->SetPadBorderMode(0);
1584 gStyle->SetCanvasColor(10);
1585 gStyle->SetPadLeftMargin(0.13);
1586 gStyle->SetPadRightMargin(0.01);
1587 TCanvas *stat = new TCanvas("stat","",50,50,600,800);
1590 NbEntries->Draw("");
1592 NbEntriesPerSp->SetStats(0);
1593 NbEntriesPerSp->Draw("");
1594 TCanvas *stat1 = new TCanvas("stat1","",50,50,600,800);
1596 NbEntriesPerGroup->SetStats(0);
1597 NbEntriesPerGroup->Draw("");
1603 //____________________________________________________________________________
1604 Double_t *AliTRDCalibraFillHisto::GetMeanMedianRMSNumberCH()
1607 // Return a Int_t[4] with:
1608 // 0 Mean number of entries
1609 // 1 median of number of entries
1610 // 2 rms of number of entries
1611 // 3 number of group with entries
1614 Double_t *stat = new Double_t[4];
1617 Int_t nbofgroups = CalculateTotalNumberOfBins(0);
1618 Double_t *weight = new Double_t[nbofgroups];
1619 Int_t *nonul = new Int_t[nbofgroups];
1621 for(Int_t k = 0; k < nbofgroups; k++){
1622 if(fEntriesCH[k] > 0) {
1624 nonul[(Int_t)stat[3]] = fEntriesCH[k];
1627 else weight[k] = 0.0;
1629 stat[0] = TMath::Mean(nbofgroups,fEntriesCH,weight);
1630 stat[1] = TMath::Median(nbofgroups,fEntriesCH,weight);
1631 stat[2] = TMath::RMS((Int_t)stat[3],nonul);
1636 //____________________________________________________________________________
1637 Double_t *AliTRDCalibraFillHisto::GetMeanMedianRMSNumberLinearFitter() const
1640 // Return a Int_t[4] with:
1641 // 0 Mean number of entries
1642 // 1 median of number of entries
1643 // 2 rms of number of entries
1644 // 3 number of group with entries
1647 Double_t *stat = new Double_t[4];
1650 Int_t nbofgroups = 540;
1651 Double_t *weight = new Double_t[nbofgroups];
1652 Int_t *nonul = new Int_t[nbofgroups];
1654 for(Int_t k = 0; k < nbofgroups; k++){
1655 if(fEntriesLinearFitter[k] > 0) {
1657 nonul[(Int_t) stat[3]] = fEntriesLinearFitter[k];
1660 else weight[k] = 0.0;
1662 stat[0] = TMath::Mean(nbofgroups,fEntriesLinearFitter,weight);
1663 stat[1] = TMath::Median(nbofgroups,fEntriesLinearFitter,weight);
1664 stat[2] = TMath::RMS((Int_t)stat[3],nonul);
1669 //_____________________________________________________________________________
1670 void AliTRDCalibraFillHisto::SetNumberGroupsPRF(Short_t numberGroupsPRF)
1673 // Should be between 0 and 6
1676 if ((numberGroupsPRF < 0) || (numberGroupsPRF > 6)) {
1677 AliInfo("The number of groups must be between 0 and 6!");
1680 fNgroupprf = numberGroupsPRF;
1684 //_____________________________________________________________________________
1685 void AliTRDCalibraFillHisto::SetRelativeScale(Float_t RelativeScale)
1688 // Set the factor that will divide the deposited charge
1689 // to fit in the histo range [0,300]
1692 if (RelativeScale > 0.0) {
1693 fRelativeScale = RelativeScale;
1696 AliInfo("RelativeScale must be strict positif!");
1701 //_____________________________________________________________________________
1702 void AliTRDCalibraFillHisto::SetNz(Int_t i, Short_t Nz)
1705 // Set the mode of calibration group in the z direction for the parameter i
1710 fCalibraMode->SetNz(i, Nz);
1713 AliInfo("You have to choose between 0 and 4");
1718 //_____________________________________________________________________________
1719 void AliTRDCalibraFillHisto::SetNrphi(Int_t i, Short_t Nrphi)
1722 // Set the mode of calibration group in the rphi direction for the parameter i
1727 fCalibraMode->SetNrphi(i ,Nrphi);
1730 AliInfo("You have to choose between 0 and 6");
1734 //____________Protected Functions______________________________________________
1735 //____________Create the 2D histo to be filled online__________________________
1737 //_____________________________________________________________________________
1738 void AliTRDCalibraFillHisto::CreatePRF2d(Int_t nn)
1741 // Create the 2D histos: here we have 2*fNgroupprf bins in tnp of 0.2 amplitude each
1742 // If fNgroupprf is zero then no binning in tnp
1746 name += fCalibraMode->GetNz(2);
1748 name += fCalibraMode->GetNrphi(2);
1752 if(fNgroupprf != 0){
1754 fPRF2d = new TProfile2D("PRF2d",(const Char_t *) name
1755 ,2*fNgroupprf*fNumberBinPRF,-3.0*fNgroupprf,3.0*fNgroupprf,nn,0,nn);
1756 fPRF2d->SetYTitle("Det/pad groups");
1757 fPRF2d->SetXTitle("Position x/W [pad width units]");
1758 fPRF2d->SetZTitle("Q_{i}/Q_{total}");
1759 fPRF2d->SetStats(0);
1762 fPRF2d = new TProfile2D("PRF2d",(const Char_t *) name
1763 ,fNumberBinPRF,-1.5,1.5,nn,0,nn);
1764 fPRF2d->SetYTitle("Det/pad groups");
1765 fPRF2d->SetXTitle("Position x/W [pad width units]");
1766 fPRF2d->SetZTitle("Q_{i}/Q_{total}");
1767 fPRF2d->SetStats(0);
1772 //_____________________________________________________________________________
1773 void AliTRDCalibraFillHisto::CreatePH2d(Int_t nn)
1776 // Create the 2D histos
1780 name += fCalibraMode->GetNz(1);
1782 name += fCalibraMode->GetNrphi(1);
1784 fPH2d = new TProfile2D("PH2d",(const Char_t *) name
1785 ,fTimeMax,-0.5/fSf,(Float_t) (fTimeMax-0.5)/fSf
1787 fPH2d->SetYTitle("Det/pad groups");
1788 fPH2d->SetXTitle("time [#mus]");
1789 fPH2d->SetZTitle("<PH> [a.u.]");
1793 //_____________________________________________________________________________
1794 void AliTRDCalibraFillHisto::CreateCH2d(Int_t nn)
1797 // Create the 2D histos
1801 name += fCalibraMode->GetNz(0);
1803 name += fCalibraMode->GetNrphi(0);
1805 fCH2d = new TH2I("CH2d",(const Char_t *) name
1806 ,fNumberBinCharge,0,300,nn,0,nn);
1807 fCH2d->SetYTitle("Det/pad groups");
1808 fCH2d->SetXTitle("charge deposit [a.u]");
1809 fCH2d->SetZTitle("counts");
1815 //____________Offine tracking in the AliTRDtracker_____________________________
1816 void AliTRDCalibraFillHisto::FillTheInfoOfTheTrackCH()
1819 // For the offline tracking or mcm tracklets
1820 // This function will be called in the functions UpdateHistogram...
1821 // to fill the info of a track for the relativ gain calibration
1824 Int_t nb = 0; // Nombre de zones traversees
1825 Int_t fd = -1; // Premiere zone non nulle
1826 Float_t totalcharge = 0.0; // Total charge for the supermodule histo
1831 // See if the track goes through different zones
1832 for (Int_t k = 0; k < fCalibraMode->GetNfragZ(0)*fCalibraMode->GetNfragRphi(0); k++) {
1833 if (fAmpTotal[k] > 0.0) {
1834 totalcharge += fAmpTotal[k];
1847 fEntriesCH[fCalibraMode->GetXbins(0)+fd]++;
1849 FillCH2d(fCalibraMode->GetXbins(0)+fd,fAmpTotal[fd]/fRelativeScale);
1850 //fCH2d->Fill(fAmpTotal[fd]/fRelativeScale,fCalibraMode->GetXbins(0)+fd+0.5);
1853 fCalibraVector->UpdateVectorCH(fDetectorPreviousTrack,fd,fAmpTotal[fd]/fRelativeScale);
1857 if ((fAmpTotal[fd] > 0.0) &&
1858 (fAmpTotal[fd+1] > 0.0)) {
1859 // One of the two very big
1860 if (fAmpTotal[fd] > fProcent*fAmpTotal[fd+1]) {
1862 FillCH2d(fCalibraMode->GetXbins(0)+fd,fAmpTotal[fd]/fRelativeScale);
1863 //fCH2d->Fill(fAmpTotal[fd]/fRelativeScale,fCalibraMode->GetXbins(0)+fd+0.5);
1866 fCalibraVector->UpdateVectorCH(fDetectorPreviousTrack,fd,fAmpTotal[fd]/fRelativeScale);
1869 fEntriesCH[fCalibraMode->GetXbins(0)+fd]++;
1871 if (fAmpTotal[fd+1] > fProcent*fAmpTotal[fd]) {
1873 FillCH2d(fCalibraMode->GetXbins(0)+fd+1,fAmpTotal[fd+1]/fRelativeScale);
1874 //fCH2d->Fill(fAmpTotal[fd+1]/fRelativeScale,fCalibraMode->GetXbins(0)+fd+1.5);
1877 fCalibraVector->UpdateVectorCH(fDetectorPreviousTrack,fd+1,fAmpTotal[fd+1]/fRelativeScale);
1880 fEntriesCH[fCalibraMode->GetXbins(0)+fd+1]++;
1883 if (fCalibraMode->GetNfragZ(0) > 1) {
1884 if (fAmpTotal[fd] > 0.0) {
1885 if ((fd+fCalibraMode->GetNfragZ(0)) < (fCalibraMode->GetNfragZ(0)*fCalibraMode->GetNfragRphi(0))) {
1886 if (fAmpTotal[fd+fCalibraMode->GetNfragZ(0)] > 0.0) {
1887 // One of the two very big
1888 if (fAmpTotal[fd] > fProcent*fAmpTotal[fd+fCalibraMode->GetNfragZ(0)]) {
1890 FillCH2d(fCalibraMode->GetXbins(0)+fd,fAmpTotal[fd]/fRelativeScale);
1891 //fCH2d->Fill(fAmpTotal[fd]/fRelativeScale,fCalibraMode->GetXbins(0)+fd+0.5);
1894 fCalibraVector->UpdateVectorCH(fDetectorPreviousTrack,fd,fAmpTotal[fd]/fRelativeScale);
1897 fEntriesCH[fCalibraMode->GetXbins(0)+fd]++;
1899 if (fAmpTotal[fd+fCalibraMode->GetNfragZ(0)] > fProcent*fAmpTotal[fd]) {
1901 FillCH2d(fCalibraMode->GetXbins(0)+fd+fCalibraMode->GetNfragZ(0),fAmpTotal[fd+fCalibraMode->GetNfragZ(0)]/fRelativeScale);
1902 //fCH2d->Fill(fAmpTotal[fd+fCalibraMode->GetNfragZ(0)]/fRelativeScale,fCalibraMode->GetXbins(0)+fd+fCalibraMode->GetNfragZ(0)+0.5);
1905 fEntriesCH[fCalibraMode->GetXbins(0)+fd+fCalibraMode->GetNfragZ(0)]++;
1907 fCalibraVector->UpdateVectorCH(fDetectorPreviousTrack,fd+fCalibraMode->GetNfragZ(0),fAmpTotal[fd+fCalibraMode->GetNfragZ(0)]/fRelativeScale);
1918 //____________Offine tracking in the AliTRDtracker_____________________________
1919 void AliTRDCalibraFillHisto::FillTheInfoOfTheTrackPH()
1922 // For the offline tracking or mcm tracklets
1923 // This function will be called in the functions UpdateHistogram...
1924 // to fill the info of a track for the drift velocity calibration
1927 Int_t nb = 1; // Nombre de zones traversees 1, 2 ou plus de 3
1928 Int_t fd1 = -1; // Premiere zone non nulle
1929 Int_t fd2 = -1; // Deuxieme zone non nulle
1930 Int_t k1 = -1; // Debut de la premiere zone
1931 Int_t k2 = -1; // Debut de la seconde zone
1933 // See if the track goes through different zones
1934 for (Int_t k = 0; k < fTimeMax; k++) {
1935 if (fPHValue[k] > 0.0) {
1940 if (fPHPlace[k] != fd1) {
1946 if (fPHPlace[k] != fd2) {
1958 for (Int_t i = 0; i < fTimeMax; i++) {
1960 fPH2d->Fill((Float_t) i/fSf,(fCalibraMode->GetXbins(1)+fd1)+0.5,(Float_t) fPHValue[i]);
1963 fCalibraVector->UpdateVectorPH(fDetectorPreviousTrack,fd1,i,fPHValue[i]);
1968 if ((fd1 == fd2+1) ||
1970 // One of the two fast all the think
1971 if (k2 > (k1+fDifference)) {
1972 //we choose to fill the fd1 with all the values
1974 for (Int_t i = 0; i < fTimeMax; i++) {
1976 fPH2d->Fill((Float_t) i/fSf,(fCalibraMode->GetXbins(1)+fd1)+0.5,(Float_t) fPHValue[i]);
1979 fCalibraVector->UpdateVectorPH(fDetectorPreviousTrack,fd1,i,fPHValue[i]);
1983 if ((k2+fDifference) < fTimeMax) {
1984 //we choose to fill the fd2 with all the values
1986 for (Int_t i = 0; i < fTimeMax; i++) {
1988 fPH2d->Fill((Float_t) i/fSf,(fCalibraMode->GetXbins(1)+fd2)+0.5,(Float_t) fPHValue[i]);
1991 fCalibraVector->UpdateVectorPH(fDetectorPreviousTrack,fd2,i,fPHValue[i]);
1996 // Two zones voisines sinon rien!
1997 if (fCalibraMode->GetNfragZ(1) > 1) {
1999 if ((fd1+fCalibraMode->GetNfragZ(1)) < (fCalibraMode->GetNfragZ(1)*fCalibraMode->GetNfragRphi(1))) {
2000 if (fd2 == (fd1+fCalibraMode->GetNfragZ(1))) {
2001 // One of the two fast all the think
2002 if (k2 > (k1+fDifference)) {
2003 //we choose to fill the fd1 with all the values
2005 for (Int_t i = 0; i < fTimeMax; i++) {
2007 fPH2d->Fill((Float_t) i/fSf,(fCalibraMode->GetXbins(1)+fd1)+0.5,(Float_t) fPHValue[i]);
2010 fCalibraVector->UpdateVectorPH(fDetectorPreviousTrack,fd1,i,fPHValue[i]);
2014 if ((k2+fDifference) < fTimeMax) {
2015 //we choose to fill the fd2 with all the values
2017 for (Int_t i = 0; i < fTimeMax; i++) {
2019 fPH2d->Fill((Float_t) i/fSf,(fCalibraMode->GetXbins(1)+fd2)+0.5,(Float_t) fPHValue[i]);
2022 fCalibraVector->UpdateVectorPH(fDetectorPreviousTrack,fd2,i,fPHValue[i]);
2028 // Two zones voisines sinon rien!
2030 if ((fd1 - fCalibraMode->GetNfragZ(1)) >= 0) {
2031 if (fd2 == (fd1 - fCalibraMode->GetNfragZ(1))) {
2032 // One of the two fast all the think
2033 if (k2 > (k1 + fDifference)) {
2034 //we choose to fill the fd1 with all the values
2036 for (Int_t i = 0; i < fTimeMax; i++) {
2038 fPH2d->Fill((Float_t) i/fSf,(fCalibraMode->GetXbins(1)+fd1)+0.5,(Float_t) fPHValue[i]);
2041 fCalibraVector->UpdateVectorPH(fDetectorPreviousTrack,fd1,i,fPHValue[i]);
2045 if ((k2+fDifference) < fTimeMax) {
2046 //we choose to fill the fd2 with all the values
2048 for (Int_t i = 0; i < fTimeMax; i++) {
2050 fPH2d->Fill((Float_t) i/fSf,(fCalibraMode->GetXbins(1)+fd2)+0.5,(Float_t) fPHValue[i]);
2053 fCalibraVector->UpdateVectorPH(fDetectorPreviousTrack,fd2,i,fPHValue[i]);
2064 //____________Offine tracking in the AliTRDtracker_____________________________
2065 Bool_t AliTRDCalibraFillHisto::FindP1TrackPH()
2068 // For the offline tracking
2069 // This function will be called in the functions UpdateHistogram...
2070 // to fill the find the parameter P1 of a track for the drift velocity calibration
2074 //Number of points: if less than 3 return kFALSE
2075 Int_t Npoints = fListClusters->GetEntriesFast();
2076 if(Npoints <= 2) return kFALSE;
2079 TLinearFitter linearFitterTracklet = TLinearFitter(2,"pol1"); // TLinearFitter per tracklet
2080 Double_t snp = 0.0; // sin angle in the plan yx track
2081 Double_t y = 0.0; // y clusters in the middle of the chamber
2082 Double_t z = 0.0; // z cluster in the middle of the chamber
2083 Double_t dydt = 0.0; // dydt tracklet after straight line fit
2084 Double_t tnp = 0.0; // tan angle in the plan xy track
2085 Double_t tgl = 0.0; // dz/dl and not dz/dx!
2086 Double_t errorpar = 0.0; // error after straight line fit on dy/dt
2087 Double_t pointError = 0.0; // error after straight line fit
2088 Int_t detector = ((AliTRDcluster *) fListClusters->At(0))->GetDetector(); //detector
2089 Int_t snpright = 1; // if we took in the middle snp
2090 Int_t crossrow = 0; // if it crosses a pad row
2091 Double_t tiltingangle = 0; // tiltingangle of the pad
2092 Float_t dzdx = 0; // dz/dx now from dz/dl
2093 Int_t nbli = 0; // number linear fitter points
2094 AliTRDpadPlane *padplane = fGeo->GetPadPlane(GetPlane(detector),GetChamber(detector));
2096 linearFitterTracklet.StoreData(kFALSE);
2097 linearFitterTracklet.ClearPoints();
2099 //if more than one row
2100 Int_t rowp = -1; // if it crosses a pad row
2103 tiltingangle = padplane->GetTiltingAngle();
2104 Float_t tnt = TMath::Tan(tiltingangle/180.*TMath::Pi()); // tan tiltingangle
2107 for(Int_t k = 0; k < Npoints; k++){
2109 AliTRDcluster *cl = (AliTRDcluster *) fListClusters->At(k);
2110 Double_t ycluster = cl->GetY();
2111 Int_t time = cl->GetLocalTimeBin();
2112 Double_t timeis = time/fSf;
2113 //See if cross two pad rows
2114 Int_t row = padplane->GetPadRowNumber(cl->GetZ());
2115 if(k==0) rowp = row;
2116 if(row != rowp) crossrow = 1;
2117 //Take in the middle of the chamber
2119 if(time > (Int_t) 10) {
2121 //if(time < (Int_t) 11) {
2127 linearFitterTracklet.AddPoint(&timeis,ycluster,1);
2131 if(((AliTRDcluster *) fListClusters->At(0))->GetLocalTimeBin() < 10) snpright = 0;
2133 //if(((AliTRDcluster *) fListClusters->At(0))->GetLocalTimeBin() >= 11) snpright = 0;
2134 if(nbli <= 2) return kFALSE;
2136 // Do the straight line fit now
2138 linearFitterTracklet.Eval();
2139 linearFitterTracklet.GetParameters(pars);
2140 pointError = TMath::Sqrt(linearFitterTracklet.GetChisquare()/nbli);
2141 errorpar = linearFitterTracklet.GetParError(1)*pointError;
2144 if( TMath::Abs(snp) < 1.){
2145 tnp = snp / (TMath::Sqrt(1-(snp*snp)));
2147 dzdx = tgl*TMath::Sqrt(1+tnp*tnp);
2149 if(fDebugLevel > 0){
2150 if ( !fDebugStreamer ) {
2152 TDirectory *backup = gDirectory;
2153 fDebugStreamer = new TTreeSRedirector("TRDdebugCalibraFill.root");
2154 if ( backup ) backup->cd(); //we don't want to be cd'd to the debug streamer
2157 (* fDebugStreamer) << "VDRIFT0"<<
2158 "Npoints="<<Npoints<<
2162 (* fDebugStreamer) << "VDRIFT"<<
2163 "snpright="<<snpright<<
2164 "Npoints="<<Npoints<<
2166 "detector="<<detector<<
2175 "crossrow="<<crossrow<<
2176 "errorpar="<<errorpar<<
2177 "pointError="<<pointError<<
2182 if(Npoints < fNumberClusters) return kFALSE;
2183 if(snpright == 0) return kFALSE;
2184 if(pointError >= 0.1) return kFALSE;
2185 if(crossrow == 1) return kFALSE;
2187 if(fLinearFitterOn){
2188 //Add to the linear fitter of the detector
2189 if( TMath::Abs(snp) < 1.){
2190 Double_t x = tnp-dzdx*tnt;
2191 (GetLinearFitter(detector,kTRUE))->AddPoint(&x,dydt);
2192 if(fLinearFitterDebugOn) {
2193 fLinearVdriftFit->Update(detector,x,pars[1]);
2195 fEntriesLinearFitter[detector]++;
2198 //AliInfo("End of FindP1TrackPH with success!")
2202 //____________Offine tracking in the AliTRDtracker_____________________________
2203 Bool_t AliTRDCalibraFillHisto::HandlePRF()
2206 // For the offline tracking
2207 // Fit the tracklet with a line and take the position as reference for the PRF
2211 Int_t Npoints = fListClusters->GetEntriesFast(); // number of total points
2212 Int_t Nb3pc = 0; // number of three pads clusters used for fit
2213 Int_t detector = ((AliTRDcluster *) fListClusters->At(0))->GetDetector(); // detector
2216 // To see the difference due to the fit
2217 Double_t *padPositions;
2218 padPositions = new Double_t[Npoints];
2219 for(Int_t k = 0; k < Npoints; k++){
2220 padPositions[k] = 0.0;
2224 //Find the position by a fit
2225 TLinearFitter fitter(2,"pol1");
2226 fitter.StoreData(kFALSE);
2227 fitter.ClearPoints();
2228 for(Int_t k = 0; k < Npoints; k++){
2230 AliTRDcluster *cl = (AliTRDcluster *) fListClusters->At(k);
2231 Short_t *signals = cl->GetSignals();
2232 Double_t time = cl->GetLocalTimeBin();
2233 //Calculate x if possible
2234 Float_t xcenter = 0.0;
2235 Bool_t echec = kTRUE;
2236 if((time<=7) || (time>=21)) continue;
2237 // Center 3 balanced: position with the center of the pad
2238 if ((((Float_t) signals[3]) > 0.0) &&
2239 (((Float_t) signals[2]) > 0.0) &&
2240 (((Float_t) signals[4]) > 0.0)) {
2242 // Security if the denomiateur is 0
2243 if ((((Float_t) (((Float_t) signals[3]) * ((Float_t) signals[3]))) /
2244 ((Float_t) (((Float_t) signals[2]) * ((Float_t) signals[4])))) != 1.0) {
2245 xcenter = 0.5 * (TMath::Log((Float_t) (((Float_t) signals[4]) / ((Float_t) signals[2]))))
2246 / (TMath::Log(((Float_t) (((Float_t) signals[3]) * ((Float_t) signals[3])))
2247 / ((Float_t) (((Float_t) signals[2]) * ((Float_t) signals[4])))));
2253 if(TMath::Abs(xcenter) > 0.5) echec = kTRUE;
2255 //if no echec: calculate with the position of the pad
2256 // Position of the cluster
2257 Double_t padPosition = xcenter + cl->GetPad();
2258 padPositions[k] = padPosition;
2260 fitter.AddPoint(&time, padPosition,1);
2263 //printf("Nb3pc %d, Npoints %d\n",Nb3pc,Npoints);
2264 if(Nb3pc < 3) return kFALSE;
2267 fitter.GetParameters(line);
2268 Float_t pointError = -1.0;
2269 pointError = TMath::Sqrt(fitter.GetChisquare()/Nb3pc);
2273 for(Int_t k = 0; k < Npoints; k++){
2275 AliTRDcluster *cl = (AliTRDcluster *) fListClusters->At(k);
2276 Short_t *signals = cl->GetSignals(); // signal
2277 Double_t time = cl->GetLocalTimeBin(); // time bin
2278 Float_t padPosTracklet = line[0]+line[1]*time; // reconstruct position from fit
2279 Float_t padPos = cl->GetPad(); // middle pad
2280 Double_t dpad = padPosTracklet - padPos; // reconstruct position relative to middle pad from fit
2281 Float_t ycenter = 0.0; // relative center charge
2282 Float_t ymin = 0.0; // relative left charge
2283 Float_t ymax = 0.0; // relative right charge
2284 Double_t tgl = fPar3[(Int_t)time]; // dz/dl and not dz/dx
2285 Double_t pt = fPar4[(Int_t)time]; // pt
2286 Float_t dzdx = 0.0; // dzdx
2289 //Requiere simply two pads clusters at least
2290 if(((((Float_t) signals[3]) > 0.0) && (((Float_t) signals[2]) > 0.0)) ||
2291 ((((Float_t) signals[3]) > 0.0) && (((Float_t) signals[4]) > 0.0))){
2292 Float_t sum = ((Float_t) signals[2]) + ((Float_t) signals[3]) + ((Float_t) signals[4]);
2293 if(sum > 0.0) ycenter = ((Float_t) signals[3])/ sum;
2294 if(sum > 0.0) ymin = ((Float_t) signals[2])/ sum;
2295 if(sum > 0.0) ymax = ((Float_t) signals[4])/ sum;
2299 Int_t *rowcol = CalculateRowCol(cl); // calcul col and row pad of the cluster
2300 Int_t grouplocal = CalculateCalibrationGroup(2,rowcol); // calcul the corresponding group
2301 Int_t caligroup = fCalibraMode->GetXbins(2)+ grouplocal; // calcul the corresponding group
2302 Double_t snp = fPar2[(Int_t)time]; // sin angle in xy plan
2303 Float_t xcl = cl->GetY(); // y cluster
2304 Float_t qcl = cl->GetQ(); // charge cluster
2305 Int_t plane = GetPlane(detector); // plane
2306 Int_t chamber = GetChamber(detector); // chamber
2307 Double_t xdiff = dpad; // reconstructed position constant
2308 Double_t x = dpad; // reconstructed position moved
2309 Float_t Ep = pointError; // error of fit
2310 Float_t signal1 = (Float_t)signals[1]; // signal at the border
2311 Float_t signal3 = (Float_t)signals[3]; // signal
2312 Float_t signal2 = (Float_t)signals[2]; // signal
2313 Float_t signal4 = (Float_t)signals[4]; // signal
2314 Float_t signal5 = (Float_t)signals[5]; // signal at the border
2316 if(TMath::Abs(snp) < 1.0){
2317 tnp = snp / (TMath::Sqrt(1-snp*snp));
2318 dzdx = tgl*TMath::Sqrt(1+tnp*tnp);
2322 if(fDebugLevel > 0){
2323 if ( !fDebugStreamer ) {
2325 TDirectory *backup = gDirectory;
2326 fDebugStreamer = new TTreeSRedirector("TRDdebugCalibraFill.root");
2327 if ( backup ) backup->cd(); //we don't want to be cd'd to the debug streamer
2330 (* fDebugStreamer) << "PRF0"<<
2331 "caligroup="<<caligroup<<
2332 "detector="<<detector<<
2334 "chamber="<<chamber<<
2335 "Npoints="<<Npoints<<
2344 "padPosition="<<padPositions[k]<<
2345 "padPosTracklet="<<padPosTracklet<<
2347 "ycenter="<<ycenter<<
2352 "signal1="<<signal1<<
2353 "signal2="<<signal2<<
2354 "signal3="<<signal3<<
2355 "signal4="<<signal4<<
2356 "signal5="<<signal5<<
2361 Float_t y = ycenter;
2362 (* fDebugStreamer) << "PRFALL"<<
2363 "caligroup="<<caligroup<<
2364 "detector="<<detector<<
2366 "chamber="<<chamber<<
2367 "Npoints="<<Npoints<<
2377 "padPosition="<<padPositions[k]<<
2378 "padPosTracklet="<<padPosTracklet<<
2383 "signal1="<<signal1<<
2384 "signal2="<<signal2<<
2385 "signal3="<<signal3<<
2386 "signal4="<<signal4<<
2387 "signal5="<<signal5<<
2393 (* fDebugStreamer) << "PRFALL"<<
2394 "caligroup="<<caligroup<<
2395 "detector="<<detector<<
2397 "chamber="<<chamber<<
2398 "Npoints="<<Npoints<<
2408 "padPosition="<<padPositions[k]<<
2409 "padPosTracklet="<<padPosTracklet<<
2414 "signal1="<<signal1<<
2415 "signal2="<<signal2<<
2416 "signal3="<<signal3<<
2417 "signal4="<<signal4<<
2418 "signal5="<<signal5<<
2425 (* fDebugStreamer) << "PRFALL"<<
2426 "caligroup="<<caligroup<<
2427 "detector="<<detector<<
2429 "chamber="<<chamber<<
2430 "Npoints="<<Npoints<<
2440 "padPosition="<<padPositions[k]<<
2441 "padPosTracklet="<<padPosTracklet<<
2446 "signal1="<<signal1<<
2447 "signal2="<<signal2<<
2448 "signal3="<<signal3<<
2449 "signal4="<<signal4<<
2450 "signal5="<<signal5<<
2457 if(Npoints < fNumberClusters) continue;
2458 if(Nb3pc <= 5) continue;
2459 if((time >= 21) || (time < 7)) continue;
2460 if(TMath::Abs(snp) >= 1.0) continue;
2461 if(qcl < 80) continue;
2463 Bool_t echec = kFALSE;
2464 Double_t shift = 0.0;
2465 //Calculate the shift in x coresponding to this tnp
2466 if(fNgroupprf != 0.0){
2467 shift = -3.0*(fNgroupprf-1)-1.5;
2468 Double_t limithigh = -0.2*(fNgroupprf-1);
2469 if((tnp < (-0.2*fNgroupprf)) || (tnp > (0.2*fNgroupprf))) echec = kTRUE;
2471 while(tnp > limithigh){
2477 if (fHisto2d && !echec) {
2478 if(TMath::Abs(dpad) < 1.5) {
2479 fPRF2d->Fill(shift+dpad,(caligroup+0.5),ycenter);
2480 fPRF2d->Fill(shift-dpad,(caligroup+0.5),ycenter);
2482 if((ymin > 0.0) && (TMath::Abs(dpad+1.0) < 1.5)) {
2483 fPRF2d->Fill(shift-(dpad+1.0),(caligroup+0.5),ymin);
2484 fPRF2d->Fill(shift+(dpad+1.0),(caligroup+0.5),ymin);
2486 if((ymax > 0.0) && (TMath::Abs(dpad-1.0) < 1.5)) {
2487 fPRF2d->Fill(shift+1.0-dpad,(caligroup+0.5),ymax);
2488 fPRF2d->Fill(shift-1.0+dpad,(caligroup+0.5),ymax);
2491 //Not equivalent anymore here!
2492 if (fVector2d && !echec) {
2493 if(TMath::Abs(dpad) < 1.5) {
2494 fCalibraVector->UpdateVectorPRF(fDetectorPreviousTrack,grouplocal,shift+dpad,ycenter);
2495 fCalibraVector->UpdateVectorPRF(fDetectorPreviousTrack,grouplocal,shift-dpad,ycenter);
2497 if((ymin > 0.0) && (TMath::Abs(dpad+1.0) < 1.5)) {
2498 fCalibraVector->UpdateVectorPRF(fDetectorPreviousTrack,grouplocal,shift-(dpad+1.0),ymin);
2499 fCalibraVector->UpdateVectorPRF(fDetectorPreviousTrack,grouplocal,shift+(dpad+1.0),ymin);
2501 if((ymax > 0.0) && (TMath::Abs(dpad-1.0) < 1.5)) {
2502 fCalibraVector->UpdateVectorPRF(fDetectorPreviousTrack,grouplocal,shift+1.0-dpad,ymax);
2503 fCalibraVector->UpdateVectorPRF(fDetectorPreviousTrack,grouplocal,shift-1.0+dpad,ymax);
2510 //____________Offine tracking in the AliTRDtracker_____________________________
2511 Bool_t AliTRDCalibraFillHisto::FindP1TrackPHtrack(AliTRDtrack *t, Int_t index0, Int_t index1)
2514 // For the offline tracking
2515 // This function will be called in the functions UpdateHistogram...
2516 // to fill the find the parameter P1 of a track for the drift velocity calibration
2520 //Number of points: if less than 3 return kFALSE
2521 Int_t Npoints = index1-index0;
2522 if(Npoints <= 2) return kFALSE;
2525 TLinearFitter linearFitterTracklet = TLinearFitter(2,"pol1"); // TLinearFitter per tracklet
2526 Double_t snp = 0.0; // sin angle in the plan yx track
2527 Double_t y = 0.0; // y clusters in the middle of the chamber
2528 Double_t z = 0.0; // z cluster in the middle of the chamber
2529 Double_t dydt = 0.0; // dydt tracklet after straight line fit
2530 Double_t tnp = 0.0; // tan angle in the plan xy track
2531 Double_t tgl = 0.0; // dz/dl and not dz/dx!
2532 Double_t errorpar = 0.0; // error after straight line fit on dy/dt
2533 Double_t pointError = 0.0; // error after straight line fit
2534 Int_t detector = ((AliTRDcluster *) t->GetCluster(index0))->GetDetector(); //detector
2535 //Int_t snpright = 1; // if we took in the middle snp
2536 Int_t crossrow = 0; // if it crosses a pad row
2537 Double_t tiltingangle = 0; // tiltingangle of the pad
2538 Float_t dzdx = 0; // dz/dx now from dz/dl
2539 Int_t nbli = 0; // number linear fitter points
2540 AliTRDpadPlane *padplane = fGeo->GetPadPlane(GetPlane(detector),GetChamber(detector));
2542 linearFitterTracklet.StoreData(kFALSE);
2543 linearFitterTracklet.ClearPoints();
2545 //if more than one row
2546 Int_t rowp = -1; // if it crosses a pad row
2549 tiltingangle = padplane->GetTiltingAngle();
2550 Float_t tnt = TMath::Tan(tiltingangle/180.*TMath::Pi()); // tan tiltingangle
2553 for(Int_t k = 0; k < Npoints; k++){
2555 AliTRDcluster *cl = (AliTRDcluster *) t->GetCluster(k+index0);
2556 Double_t ycluster = cl->GetY();
2557 Int_t time = cl->GetLocalTimeBin();
2558 Double_t timeis = time/fSf;
2559 //See if cross two pad rows
2560 Int_t row = padplane->GetPadRowNumber(cl->GetZ());
2561 if(k==0) rowp = row;
2562 if(row != rowp) crossrow = 1;
2563 //Take in the middle of the chamber
2565 //if(time > (Int_t) 10) {
2567 if(time < (Int_t) 11) {
2571 linearFitterTracklet.AddPoint(&timeis,ycluster,1);
2575 // take now the snp, tnp and tgl from the track
2576 snp = t->GetSnpPlane(GetPlane(detector));
2577 tgl = t->GetTglPlane(GetPlane(detector));
2580 //if(((AliTRDcluster *) t->GetCluster(index0))->GetLocalTimeBin() < 10) snpright = 0;
2582 //if(((AliTRDcluster *) t->GetCluster(index0))->GetLocalTimeBin() >= 11) snpright = 0;
2583 if(nbli <= 2) return kFALSE;
2585 // Do the straight line fit now
2587 linearFitterTracklet.Eval();
2588 linearFitterTracklet.GetParameters(pars);
2589 pointError = TMath::Sqrt(linearFitterTracklet.GetChisquare()/nbli);
2590 errorpar = linearFitterTracklet.GetParError(1)*pointError;
2593 if( TMath::Abs(snp) < 1.){
2594 tnp = snp / (TMath::Sqrt(1-(snp*snp)));
2596 dzdx = tgl*TMath::Sqrt(1+tnp*tnp);
2598 if(fDebugLevel > 0){
2599 if ( !fDebugStreamer ) {
2601 TDirectory *backup = gDirectory;
2602 fDebugStreamer = new TTreeSRedirector("TRDdebugCalibraFill.root");
2603 if ( backup ) backup->cd(); //we don't want to be cd'd to the debug streamer
2607 (* fDebugStreamer) << "VDRIFT"<<
2608 //"snpright="<<snpright<<
2609 "Npoints="<<Npoints<<
2611 "detector="<<detector<<
2620 "crossrow="<<crossrow<<
2621 "errorpar="<<errorpar<<
2622 "pointError="<<pointError<<
2627 if(Npoints < fNumberClusters) return kFALSE;
2628 //if(snpright == 0) return kFALSE;
2629 if(pointError >= 0.1) return kFALSE;
2630 if(crossrow == 1) return kFALSE;
2632 if(fLinearFitterOn){
2633 //Add to the linear fitter of the detector
2634 if( TMath::Abs(snp) < 1.){
2635 Double_t x = tnp-dzdx*tnt;
2636 (GetLinearFitter(detector,kTRUE))->AddPoint(&x,dydt);
2637 if(fLinearFitterDebugOn) {
2638 fLinearVdriftFit->Update(detector,x,pars[1]);
2640 fEntriesLinearFitter[detector]++;
2643 //AliInfo("End of FindP1TrackPH with success!")
2647 //____________Offine tracking in the AliTRDtracker_____________________________
2648 Bool_t AliTRDCalibraFillHisto::HandlePRFtrack(AliTRDtrack *t, Int_t index0, Int_t index1)
2651 // For the offline tracking
2652 // Fit the tracklet with a line and take the position as reference for the PRF
2656 Int_t Npoints = index1-index0; // number of total points
2657 Int_t Nb3pc = 0; // number of three pads clusters used for fit
2658 Int_t detector = ((AliTRDcluster *) t->GetCluster(index0))->GetDetector(); // detector
2661 // To see the difference due to the fit
2662 Double_t *padPositions;
2663 padPositions = new Double_t[Npoints];
2664 for(Int_t k = 0; k < Npoints; k++){
2665 padPositions[k] = 0.0;
2669 //Find the position by a fit
2670 TLinearFitter fitter(2,"pol1");
2671 fitter.StoreData(kFALSE);
2672 fitter.ClearPoints();
2673 for(Int_t k = 0; k < Npoints; k++){
2675 AliTRDcluster *cl = (AliTRDcluster *) t->GetCluster(k+index0);
2676 Short_t *signals = cl->GetSignals();
2677 Double_t time = cl->GetLocalTimeBin();
2678 //Calculate x if possible
2679 Float_t xcenter = 0.0;
2680 Bool_t echec = kTRUE;
2681 if((time<=7) || (time>=21)) continue;
2682 // Center 3 balanced: position with the center of the pad
2683 if ((((Float_t) signals[3]) > 0.0) &&
2684 (((Float_t) signals[2]) > 0.0) &&
2685 (((Float_t) signals[4]) > 0.0)) {
2687 // Security if the denomiateur is 0
2688 if ((((Float_t) (((Float_t) signals[3]) * ((Float_t) signals[3]))) /
2689 ((Float_t) (((Float_t) signals[2]) * ((Float_t) signals[4])))) != 1.0) {
2690 xcenter = 0.5 * (TMath::Log((Float_t) (((Float_t) signals[4]) / ((Float_t) signals[2]))))
2691 / (TMath::Log(((Float_t) (((Float_t) signals[3]) * ((Float_t) signals[3])))
2692 / ((Float_t) (((Float_t) signals[2]) * ((Float_t) signals[4])))));
2698 if(TMath::Abs(xcenter) > 0.5) echec = kTRUE;
2700 //if no echec: calculate with the position of the pad
2701 // Position of the cluster
2702 Double_t padPosition = xcenter + cl->GetPad();
2703 padPositions[k] = padPosition;
2705 fitter.AddPoint(&time, padPosition,1);
2708 //printf("Nb3pc %d, Npoints %d\n",Nb3pc,Npoints);
2709 if(Nb3pc < 3) return kFALSE;
2712 fitter.GetParameters(line);
2713 Float_t pointError = -1.0;
2714 pointError = TMath::Sqrt(fitter.GetChisquare()/Nb3pc);
2716 // Take the tgl and snp with the track t now
2717 Double_t tgl = t->GetTglPlane(GetPlane(detector)); //dz/dl and not dz/dx
2718 Double_t snp = t->GetSnpPlane(GetPlane(detector)); // sin angle in xy plan
2719 Float_t dzdx = 0.0; // dzdx
2721 if(TMath::Abs(snp) < 1.0){
2722 tnp = snp / (TMath::Sqrt(1-snp*snp));
2723 dzdx = tgl*TMath::Sqrt(1+tnp*tnp);
2728 for(Int_t k = 0; k < Npoints; k++){
2730 AliTRDcluster *cl = (AliTRDcluster *) t->GetCluster(k+index0);
2731 Short_t *signals = cl->GetSignals(); // signal
2732 Double_t time = cl->GetLocalTimeBin(); // time bin
2733 Float_t padPosTracklet = line[0]+line[1]*time; // reconstruct position from fit
2734 Float_t padPos = cl->GetPad(); // middle pad
2735 Double_t dpad = padPosTracklet - padPos; // reconstruct position relative to middle pad from fit
2736 Float_t ycenter = 0.0; // relative center charge
2737 Float_t ymin = 0.0; // relative left charge
2738 Float_t ymax = 0.0; // relative right charge
2742 //Requiere simply two pads clusters at least
2743 if(((((Float_t) signals[3]) > 0.0) && (((Float_t) signals[2]) > 0.0)) ||
2744 ((((Float_t) signals[3]) > 0.0) && (((Float_t) signals[4]) > 0.0))){
2745 Float_t sum = ((Float_t) signals[2]) + ((Float_t) signals[3]) + ((Float_t) signals[4]);
2746 if(sum > 0.0) ycenter = ((Float_t) signals[3])/ sum;
2747 if(sum > 0.0) ymin = ((Float_t) signals[2])/ sum;
2748 if(sum > 0.0) ymax = ((Float_t) signals[4])/ sum;
2752 Int_t *rowcol = CalculateRowCol(cl); // calcul col and row pad of the cluster
2753 Int_t grouplocal = CalculateCalibrationGroup(2,rowcol); // calcul the corresponding group
2754 Int_t caligroup = fCalibraMode->GetXbins(2)+ grouplocal; // calcul the corresponding group
2755 Float_t xcl = cl->GetY(); // y cluster
2756 Float_t qcl = cl->GetQ(); // charge cluster
2757 Int_t plane = GetPlane(detector); // plane
2758 Int_t chamber = GetChamber(detector); // chamber
2759 Double_t xdiff = dpad; // reconstructed position constant
2760 Double_t x = dpad; // reconstructed position moved
2761 Float_t Ep = pointError; // error of fit
2762 Float_t signal1 = (Float_t)signals[1]; // signal at the border
2763 Float_t signal3 = (Float_t)signals[3]; // signal
2764 Float_t signal2 = (Float_t)signals[2]; // signal
2765 Float_t signal4 = (Float_t)signals[4]; // signal
2766 Float_t signal5 = (Float_t)signals[5]; // signal at the border
2770 if(fDebugLevel > 0){
2771 if ( !fDebugStreamer ) {
2773 TDirectory *backup = gDirectory;
2774 fDebugStreamer = new TTreeSRedirector("TRDdebugCalibraFill.root");
2775 if ( backup ) backup->cd(); //we don't want to be cd'd to the debug streamer
2778 (* fDebugStreamer) << "PRF0"<<
2779 "caligroup="<<caligroup<<
2780 "detector="<<detector<<
2782 "chamber="<<chamber<<
2783 "Npoints="<<Npoints<<
2791 "padPosition="<<padPositions[k]<<
2792 "padPosTracklet="<<padPosTracklet<<
2794 "ycenter="<<ycenter<<
2799 "signal1="<<signal1<<
2800 "signal2="<<signal2<<
2801 "signal3="<<signal3<<
2802 "signal4="<<signal4<<
2803 "signal5="<<signal5<<
2808 Float_t y = ycenter;
2809 (* fDebugStreamer) << "PRFALL"<<
2810 "caligroup="<<caligroup<<
2811 "detector="<<detector<<
2813 "chamber="<<chamber<<
2814 "Npoints="<<Npoints<<
2823 "padPosition="<<padPositions[k]<<
2824 "padPosTracklet="<<padPosTracklet<<
2829 "signal1="<<signal1<<
2830 "signal2="<<signal2<<
2831 "signal3="<<signal3<<
2832 "signal4="<<signal4<<
2833 "signal5="<<signal5<<
2839 (* fDebugStreamer) << "PRFALL"<<
2840 "caligroup="<<caligroup<<
2841 "detector="<<detector<<
2843 "chamber="<<chamber<<
2844 "Npoints="<<Npoints<<
2853 "padPosition="<<padPositions[k]<<
2854 "padPosTracklet="<<padPosTracklet<<
2859 "signal1="<<signal1<<
2860 "signal2="<<signal2<<
2861 "signal3="<<signal3<<
2862 "signal4="<<signal4<<
2863 "signal5="<<signal5<<
2870 (* fDebugStreamer) << "PRFALL"<<
2871 "caligroup="<<caligroup<<
2872 "detector="<<detector<<
2874 "chamber="<<chamber<<
2875 "Npoints="<<Npoints<<
2884 "padPosition="<<padPositions[k]<<
2885 "padPosTracklet="<<padPosTracklet<<
2890 "signal1="<<signal1<<
2891 "signal2="<<signal2<<
2892 "signal3="<<signal3<<
2893 "signal4="<<signal4<<
2894 "signal5="<<signal5<<
2901 if(Npoints < fNumberClusters) continue;
2902 if(Nb3pc <= 5) continue;
2903 if((time >= 21) || (time < 7)) continue;
2904 if(TMath::Abs(snp) >= 1.0) continue;
2905 if(qcl < 80) continue;
2907 Bool_t echec = kFALSE;
2908 Double_t shift = 0.0;
2909 //Calculate the shift in x coresponding to this tnp
2910 if(fNgroupprf != 0.0){
2911 shift = -3.0*(fNgroupprf-1)-1.5;
2912 Double_t limithigh = -0.2*(fNgroupprf-1);
2913 if((tnp < (-0.2*fNgroupprf)) || (tnp > (0.2*fNgroupprf))) echec = kTRUE;
2915 while(tnp > limithigh){
2921 if (fHisto2d && !echec) {
2922 if(TMath::Abs(dpad) < 1.5) {
2923 fPRF2d->Fill(shift+dpad,(caligroup+0.5),ycenter);
2924 fPRF2d->Fill(shift-dpad,(caligroup+0.5),ycenter);
2926 if((ymin > 0.0) && (TMath::Abs(dpad+1.0) < 1.5)) {
2927 fPRF2d->Fill(shift-(dpad+1.0),(caligroup+0.5),ymin);
2928 fPRF2d->Fill(shift+(dpad+1.0),(caligroup+0.5),ymin);
2930 if((ymax > 0.0) && (TMath::Abs(dpad-1.0) < 1.5)) {
2931 fPRF2d->Fill(shift+1.0-dpad,(caligroup+0.5),ymax);
2932 fPRF2d->Fill(shift-1.0+dpad,(caligroup+0.5),ymax);
2935 //Not equivalent anymore here!
2936 if (fVector2d && !echec) {
2937 if(TMath::Abs(dpad) < 1.5) {
2938 fCalibraVector->UpdateVectorPRF(fDetectorPreviousTrack,grouplocal,shift+dpad,ycenter);
2939 fCalibraVector->UpdateVectorPRF(fDetectorPreviousTrack,grouplocal,shift-dpad,ycenter);
2941 if((ymin > 0.0) && (TMath::Abs(dpad+1.0) < 1.5)) {
2942 fCalibraVector->UpdateVectorPRF(fDetectorPreviousTrack,grouplocal,shift-(dpad+1.0),ymin);
2943 fCalibraVector->UpdateVectorPRF(fDetectorPreviousTrack,grouplocal,shift+(dpad+1.0),ymin);
2945 if((ymax > 0.0) && (TMath::Abs(dpad-1.0) < 1.5)) {
2946 fCalibraVector->UpdateVectorPRF(fDetectorPreviousTrack,grouplocal,shift+1.0-dpad,ymax);
2947 fCalibraVector->UpdateVectorPRF(fDetectorPreviousTrack,grouplocal,shift-1.0+dpad,ymax);
2955 //____________Some basic geometry function_____________________________________
2957 //_____________________________________________________________________________
2958 Int_t AliTRDCalibraFillHisto::GetPlane(Int_t d) const
2961 // Reconstruct the plane number from the detector number
2964 return ((Int_t) (d % 6));
2968 //_____________________________________________________________________________
2969 Int_t AliTRDCalibraFillHisto::GetChamber(Int_t d) const
2972 // Reconstruct the chamber number from the detector number
2976 return ((Int_t) (d % 30) / fgkNplan);
2980 //_____________________________________________________________________________
2981 Int_t AliTRDCalibraFillHisto::GetSector(Int_t d) const
2984 // Reconstruct the sector number from the detector number
2988 return ((Int_t) (d / fg));
2991 //_____________________________________________________________________
2992 TProfile2D* AliTRDCalibraFillHisto::GetPH2d(Int_t nbtimebin, Float_t samplefrequency)
2995 // return pointer to fPH2d TProfile2D
2996 // create a new TProfile2D if it doesn't exist allready
3002 fTimeMax = nbtimebin;
3003 fSf = samplefrequency;
3006 AliInfo(Form("The pad calibration mode for the drift velocity calibration: Nz %d, and Nrphi %d"
3007 ,fCalibraMode->GetNz(1)
3008 ,fCalibraMode->GetNrphi(1)));
3010 // Calcul the number of Xbins
3012 fCalibraMode->ModePadCalibration(2,1);
3013 fCalibraMode->ModePadFragmentation(0,2,0,1);
3014 fCalibraMode->SetDetChamb2(1);
3015 Ntotal1 += 6 * 18 * fCalibraMode->GetDetChamb2(1);
3016 fCalibraMode->ModePadCalibration(0,1);
3017 fCalibraMode->ModePadFragmentation(0,0,0,1);
3018 fCalibraMode->SetDetChamb0(1);
3019 Ntotal1 += 6 * 4 * 18 * fCalibraMode->GetDetChamb0(1);
3020 AliInfo(Form("Total number of Xbins: %d",Ntotal1));
3022 CreatePH2d(Ntotal1);
3029 //_____________________________________________________________________
3030 TLinearFitter* AliTRDCalibraFillHisto::GetLinearFitter(Int_t detector, Bool_t force)
3033 // return pointer to TLinearFitter Calibration
3034 // if force is true create a new TLinearFitter if it doesn't exist allready
3037 if ((!force) || (fLinearFitterArray.UncheckedAt(detector))){
3038 return (TLinearFitter*)fLinearFitterArray.UncheckedAt(detector);
3041 // if we are forced and TLinearFitter doesn't yet exist create it
3043 // new TLinearFitter
3044 TLinearFitter *linearfitter = new TLinearFitter(2,"pol1");
3045 fLinearFitterArray.AddAt(linearfitter,detector);
3046 return linearfitter;
3049 //_____________________________________________________________________
3050 void AliTRDCalibraFillHisto::FillCH2d(Int_t x, Float_t y)
3053 // FillCH2d: Marian style
3056 //skip simply the value out of range
3057 if((y>=300.0) || (y<0.0)) return;
3059 //Calcul the y place
3060 Int_t yplace = (Int_t) (fNumberBinCharge*y/300.0)+1;
3061 Int_t place = (fNumberBinCharge+2)*(x+1)+yplace;
3064 fCH2d->GetArray()[place]++;
3068 //____________________________________________________________________________
3069 void AliTRDCalibraFillHisto::AnalyseLinearFitter()
3072 // Analyse array of linear fitter because can not be written
3073 // Store two arrays: one with the param the other one with the error param + number of entries
3076 for(Int_t k = 0; k < 540; k++){
3077 TLinearFitter *linearfitter = GetLinearFitter(k);
3078 if((linearfitter!=0) && (fEntriesLinearFitter[k]>10)){
3079 TVectorD *par = new TVectorD(2);
3080 TVectorD pare = TVectorD(2);
3081 TVectorD *parE = new TVectorD(3);
3082 linearfitter->Eval();
3083 linearfitter->GetParameters(*par);
3084 linearfitter->GetErrors(pare);
3085 Float_t ppointError = TMath::Sqrt(TMath::Abs(linearfitter->GetChisquare())/fEntriesLinearFitter[k]);
3086 (*parE)[0] = pare[0]*ppointError;
3087 (*parE)[1] = pare[1]*ppointError;
3088 (*parE)[2] = (Double_t) fEntriesLinearFitter[k];
3089 ((TObjArray *)fLinearVdriftFit->GetPArray())->AddAt(par,k);
3090 ((TObjArray *)fLinearVdriftFit->GetEArray())->AddAt(parE,k);
3094 //________________________________________________________________________________
3095 Int_t AliTRDCalibraFillHisto::Arrondi(Double_t x) const
3097 // Partie entiere of the (x+0.5)
3102 //if (x + 0.5 == Float_t(i) && i & 1) i--;
3105 //if (x - 0.5 == Float_t(i) && i & 1) i++;