-Int_t AliTRDCalibraFillHisto::FillDAQ(AliTRDmcm *mcm){
-
- //
- // Return 2 if some tracklets are found and used, 1 if nothing
- //
-
- Int_t nbev = 0;
-
- if(mcm->Run()){
-
- for (Int_t iSeed = 0; iSeed < 4; iSeed++) {
-
- if (mcm->GetSeedCol()[iSeed] < 0) {
- continue;
- }
-
- nbev += TestTracklet(mcm->GetChaId(),mcm->GetRow(),iSeed,mcm);
- }
-
- }
-
- if(nbev > 0) nbev = 2;
- else nbev = 1;
-
- return nbev;
-
-}
-//__________________________________________________________________________
-Int_t AliTRDCalibraFillHisto::TestTracklet( Int_t idet, Int_t row, Int_t iSeed, AliTRDmcm *mcm){
-
- //
- // Build the tracklet and return if the tracklet if finally used or not (1/0)
- //
-
- Int_t nbev = 0;
-
- AliTRDmcmTracklet mcmtracklet = AliTRDmcmTracklet();
- //mcmtracklet.Reset();
- mcmtracklet.SetDetector(idet);
- mcmtracklet.SetRow(row);
- mcmtracklet.SetN(0);
-
- Int_t iCol, iCol1, iCol2, track[3];
- iCol = mcm->GetSeedCol()[iSeed]; // 0....20 (MCM)
- mcm->GetColRange(iCol1,iCol2); // range in the pad plane
-
- Float_t amp[3];
- for (Int_t iTime = 0; iTime < fTimeMax; iTime++) {
-
- amp[0] = mcm->GetADC(iCol-1,iTime);
- amp[1] = mcm->GetADC(iCol ,iTime);
- amp[2] = mcm->GetADC(iCol+1,iTime);
-
- if(mcm->IsCluster(iCol,iTime)) {
-
- mcmtracklet.AddCluster(iCol+iCol1,iTime,amp,track);
-
- }
- else if ((iCol+1+1) < 21) {
-
- amp[0] = mcm->GetADC(iCol-1+1,iTime);
- amp[1] = mcm->GetADC(iCol +1,iTime);
- amp[2] = mcm->GetADC(iCol+1+1,iTime);
-
- if(mcm->IsCluster(iCol+1,iTime)) {
-
- mcmtracklet.AddCluster(iCol+1+iCol1,iTime,amp,track);
-
- }
-
- }
-
- }
-
-
- nbev = UpdateHistogramcm(&mcmtracklet);
-
- return nbev;
-
-}
-//____________Online trackling in AliTRDtrigger________________________________
-Int_t AliTRDCalibraFillHisto::UpdateHistogramcm(AliTRDmcmTracklet *trk)
-{
- //
- // Return if the tracklet is finally used or not (1/0) for calibration
- //
-
- Int_t used = 1;
-
- fGoodTracklet = kTRUE;
-
- // Localisation of the Xbins involved
- Int_t idect = trk->GetDetector();
- Int_t idectrue = trk->GetDetector();
- idect = 0;
-
- Int_t nbclusters = trk->GetNclusters();
-
- // Eventuelle correction due to track angle in z direction
- Float_t correction = 1.0;
- if (fMcmCorrectAngle) {
- Float_t z = trk->GetRowz();
- Float_t r = trk->GetTime0();
- correction = r / TMath::Sqrt((r*r+z*z));
- }
-
- //row
- Int_t row = trk->GetRow();
-
-
- // Boucle sur les clusters
- // Condition on number of cluster: don't come from the middle of the detector
-
- Double_t amph[36];
- for(Int_t k =0; k < 36; k++) amph[k]=0.0;
- Double_t ampTotal = 0.0;
-
- for (Int_t icl = 0; icl < trk->GetNclusters(); icl++) {
-
- Float_t amp[3] = { 0.0, 0.0, 0.0 };
- Int_t time = trk->GetClusterTime(icl);
- Int_t col = trk->GetClusterCol(icl);
-
- CheckGoodTracklet(idect,row,col);
-
- amp[0] = trk->GetClusterADC(icl)[0] * correction;
- amp[1] = trk->GetClusterADC(icl)[1] * correction;
- amp[2] = trk->GetClusterADC(icl)[2] * correction;
-
- ampTotal += (Float_t) (amp[0]+amp[1]+amp[2]);
- amph[time]=amp[0]+amp[1]+amp[2];
-
- if(fDebugLevel > 0){
- if ( !fDebugStreamer ) {
- //debug stream
- TDirectory *backup = gDirectory;
- fDebugStreamer = new TTreeSRedirector("TRDdebugCalibraFill.root");
- if ( backup ) backup->cd(); //we don't want to be cd'd to the debug streamer
- }
-
- Double_t amp0 = amp[0];
- Double_t amp1 = amp[1];
- Double_t amp2 = amp[2];
-
- (* fDebugStreamer) << "UpdateHistogramcm0"<<
- "nbclusters="<<nbclusters<<
- "amp0="<<amp0<<
- "amp1="<<amp1<<
- "amp2="<<amp2<<
- "time="<<time<<
- "col="<<col<<
- "row="<<row<<
- "detector="<<idectrue<<
- "\n";
- }
-
- } // Boucle clusters
-
- if((amph[0] > 100.0) || (!fGoodTracklet) || (trk->GetNclusters() < fNumberClusters) || (trk->GetNclusters() > fNumberClustersf)) used = 0;
-
- if (used == 1) {
- for(Int_t k = 0; k < fTimeMax; k++) UpdateDAQ(idect,0,0,k,amph[k],fTimeMax);
- //((TH2I *)GetCH2d()->Fill(ampTotal/30.0,idect));
- } // Condition cut
-
-
- if(fDebugLevel > 0){
- if ( !fDebugStreamer ) {
- //debug stream
- TDirectory *backup = gDirectory;
- fDebugStreamer = new TTreeSRedirector("TRDdebugCalibraFill.root");
- if ( backup ) backup->cd(); //we don't want to be cd'd to the debug streamer
- }
-
- Double_t amph0 = amph[0];
- Double_t amphlast = amph[fTimeMax-1];
- Double_t rms = TMath::RMS(fTimeMax,amph);
- Int_t goodtracklet = (Int_t) fGoodTracklet;
-
- (* fDebugStreamer) << "UpdateHistogramcm1"<<
- "nbclusters="<<nbclusters<<
- "ampTotal="<<ampTotal<<
- "row="<<row<<
- "detector="<<idectrue<<
- "amph0="<<amph0<<
- "amphlast="<<amphlast<<
- "goodtracklet="<<goodtracklet<<
- "rms="<<rms<<
- "\n";
- }
-
- return used;
-
-}
-//_______________________________________________________________________