+ //Requiere simply two pads clusters at least
+ if(((((Float_t) signals[3]) > 0.0) && (((Float_t) signals[2]) > 0.0)) ||
+ ((((Float_t) signals[3]) > 0.0) && (((Float_t) signals[4]) > 0.0))){
+ Float_t sum = ((Float_t) signals[2]) + ((Float_t) signals[3]) + ((Float_t) signals[4]);
+ if(sum > 0.0) ycenter = ((Float_t) signals[3])/ sum;
+ if(sum > 0.0) ymin = ((Float_t) signals[2])/ sum;
+ if(sum > 0.0) ymax = ((Float_t) signals[4])/ sum;
+ }
+
+ //calibration group
+ Int_t rowcl = cl->GetPadRow(); // row of cluster
+ Int_t colcl = cl->GetPadCol(); // col of cluster
+ Int_t grouplocal = CalculateCalibrationGroup(2,rowcl,colcl); // calcul the corresponding group
+ Int_t caligroup = fCalibraMode->GetXbins(2)+ grouplocal; // calcul the corresponding group
+ Float_t xcl = cl->GetY(); // y cluster
+ Float_t qcl = cl->GetQ(); // charge cluster
+ Int_t layer = GetLayer(detector); // layer
+ Int_t stack = GetStack(detector); // stack
+ Double_t xdiff = dpad; // reconstructed position constant
+ Double_t x = dpad; // reconstructed position moved
+ Float_t ep = pointError; // error of fit
+ Float_t signal1 = (Float_t)signals[1]; // signal at the border
+ Float_t signal3 = (Float_t)signals[3]; // signal
+ Float_t signal2 = (Float_t)signals[2]; // signal
+ Float_t signal4 = (Float_t)signals[4]; // signal
+ Float_t signal5 = (Float_t)signals[5]; // signal at the border
+
+ //////////////////////////////
+ // debug
+ /////////////////////////////
+ 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
+ }
+
+
+ x = xdiff;
+ Int_t type=0;
+ Float_t y = ycenter;
+ (* fDebugStreamer) << "HandlePRFtracklet"<<
+ "caligroup="<<caligroup<<
+ "detector="<<detector<<
+ "layer="<<layer<<
+ "stack="<< stack <<
+ "npoints="<<npoints<<
+ "Np="<<nb3pc<<
+ "ep="<<ep<<
+ "type="<<type<<
+ "snp="<<snp<<
+ "tnp="<<tnp<<
+ "tgl="<<tgl<<
+ "dzdx="<<dzdx<<
+ "padPos="<<padPos<<
+ "padPosition="<<padPositions[k]<<
+ "padPosTracklet="<<padPosTracklet<<
+ "x="<<x<<
+ "y="<<y<<
+ "xcl="<<xcl<<
+ "qcl="<<qcl<<
+ "signal1="<<signal1<<
+ "signal2="<<signal2<<
+ "signal3="<<signal3<<
+ "signal4="<<signal4<<
+ "signal5="<<signal5<<
+ "time="<<time<<
+ "\n";
+ x=-(xdiff+1);
+ y = ymin;
+ type=-1;
+ (* fDebugStreamer) << "HandlePRFtracklet"<<
+ "caligroup="<<caligroup<<
+ "detector="<<detector<<
+ "layer="<<layer<<
+ "stack="<<stack<<
+ "npoints="<<npoints<<
+ "Np="<<nb3pc<<
+ "ep="<<ep<<
+ "type="<<type<<
+ "snp="<<snp<<
+ "tnp="<<tnp<<
+ "tgl="<<tgl<<
+ "dzdx="<<dzdx<<
+ "padPos="<<padPos<<
+ "padPosition="<<padPositions[k]<<
+ "padPosTracklet="<<padPosTracklet<<
+ "x="<<x<<
+ "y="<<y<<
+ "xcl="<<xcl<<
+ "qcl="<<qcl<<
+ "signal1="<<signal1<<
+ "signal2="<<signal2<<
+ "signal3="<<signal3<<
+ "signal4="<<signal4<<
+ "signal5="<<signal5<<
+ "time="<<time<<
+ "\n";
+ x=1-xdiff;
+ y = ymax;
+ type=1;
+ (* fDebugStreamer) << "HandlePRFtracklet"<<
+ "caligroup="<<caligroup<<
+ "detector="<<detector<<
+ "layer="<<layer<<
+ "stack="<<stack<<
+ "npoints="<<npoints<<
+ "Np="<<nb3pc<<
+ "ep="<<ep<<
+ "type="<<type<<
+ "snp="<<snp<<
+ "tnp="<<tnp<<
+ "tgl="<<tgl<<
+ "dzdx="<<dzdx<<
+ "padPos="<<padPos<<
+ "padPosition="<<padPositions[k]<<
+ "padPosTracklet="<<padPosTracklet<<
+ "x="<<x<<
+ "y="<<y<<
+ "xcl="<<xcl<<
+ "qcl="<<qcl<<
+ "signal1="<<signal1<<
+ "signal2="<<signal2<<
+ "signal3="<<signal3<<
+ "signal4="<<signal4<<
+ "signal5="<<signal5<<
+ "time="<<time<<
+ "\n";
+
+ }
+
+ ////////////////////////////
+ // quality cuts
+ ///////////////////////////
+ if(npoints < fNumberClusters) continue;
+ if(npoints > fNumberClustersf) continue;
+ if(nb3pc <= 5) continue;
+ if((time >= 21) || (time < 7)) continue;
+ if(TMath::Abs(snp) >= 1.0) continue;
+ if(TMath::Abs(qcl) < 80) continue;
+
+ ////////////////////////////
+ // Fill
+ ///////////////////////////
+ if (fHisto2d) {
+ if(TMath::Abs(dpad) < 1.5) {
+ fPRF2d->Fill(shift+dpad,(caligroup+0.5),ycenter);
+ fPRF2d->Fill(shift-dpad,(caligroup+0.5),ycenter);
+ }
+ if((ymin > 0.0) && (TMath::Abs(dpad+1.0) < 1.5)) {
+ fPRF2d->Fill(shift-(dpad+1.0),(caligroup+0.5),ymin);
+ fPRF2d->Fill(shift+(dpad+1.0),(caligroup+0.5),ymin);
+ }
+ if((ymax > 0.0) && (TMath::Abs(dpad-1.0) < 1.5)) {
+ fPRF2d->Fill(shift+1.0-dpad,(caligroup+0.5),ymax);
+ fPRF2d->Fill(shift-1.0+dpad,(caligroup+0.5),ymax);
+ }
+ }
+ if (fVector2d) {
+ if(TMath::Abs(dpad) < 1.5) {
+ fCalibraVector->UpdateVectorPRF(fDetectorPreviousTrack,grouplocal,shift+dpad,ycenter);
+ fCalibraVector->UpdateVectorPRF(fDetectorPreviousTrack,grouplocal,shift-dpad,ycenter);
+ }
+ if((ymin > 0.0) && (TMath::Abs(dpad+1.0) < 1.5)) {
+ fCalibraVector->UpdateVectorPRF(fDetectorPreviousTrack,grouplocal,shift-(dpad+1.0),ymin);
+ fCalibraVector->UpdateVectorPRF(fDetectorPreviousTrack,grouplocal,shift+(dpad+1.0),ymin);
+ }
+ if((ymax > 0.0) && (TMath::Abs(dpad-1.0) < 1.5)) {
+ fCalibraVector->UpdateVectorPRF(fDetectorPreviousTrack,grouplocal,shift+1.0-dpad,ymax);
+ fCalibraVector->UpdateVectorPRF(fDetectorPreviousTrack,grouplocal,shift-1.0+dpad,ymax);
+ }
+ }
+ }
+ delete [] padPositions;