<commit_before>/**************************************************************************
 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
 *                                                                        *
 * Author: The ALICE Off-line Project.                                    *
 * Contributors are mentioned in the code where appropriate.              *
 *                                                                        *
 * Permission to use, copy, modify and distribute this software and its   *
 * documentation strictly for non-commercial purposes is hereby granted   *
 * without fee, provided that the above copyright notice appears in all   *
 * copies and that both the copyright notice and this permission notice   *
 * appear in the supporting documentation. The authors make no claims     *
 * about the suitability of this software for any purpose. It is          *
 * provided "as is" without express or implied warranty.                  *
 **************************************************************************/


///////////////////////////////////////////////////////////////////////////////
//                                                                           //
//   Component for redoing the reconstruction from the clusters and tracks
//      
//   The new calibration data used 
//
//   In reality it overwrites the content of the ESD 
//    

/*

  gSystem->Load("libANALYSIS");
  gSystem->Load("libTPCcalib");
  //
  gSystem->AddIncludePath("-I$ALICE_ROOT/TPC/macros");
  gROOT->LoadMacro("$ALICE_ROOT/TPC/macros/AliXRDPROOFtoolkit.cxx+")
  AliXRDPROOFtoolkit tool; 
  TChain * chainCl = tool.MakeChain("calib.txt","Clusters",0,1);
  chainCl->Lookup();
  TChain * chainTr = tool.MakeChain("calib.txt","Tracks",0,1);
  chainTr->Lookup();



*/



//  <EMAIL>
// 
#include "AliTPCcalibCalib.h"
#include "TSystem.h"
#include "TFile.h"
#include "TTreeStream.h"
#include "AliLog.h"
#include "TTimeStamp.h"
#include "AliVEvent.h"
#include "AliVfriendEvent.h"
#include "AliVTrack.h"
#include "AliVfriendTrack.h"
#include "AliTracker.h"
#include "AliTPCClusterParam.h"
#include "AliTPCParam.h"

#include "AliTPCcalibDB.h"
#include "AliTPCTransform.h"
#include "AliTPCRecoParam.h"
#include "AliTPCreco.h"
#include "AliTPCclusterMI.h"
#include "AliTPCseed.h"
#include <TGeoManager.h>
#include <TGeoPhysicalNode.h>
#include "TDatabasePDG.h"
ClassImp(AliTPCcalibCalib)

AliTPCcalibCalib::AliTPCcalibCalib():
AliTPCcalibBase(),
  fApplyExBCorrection(1),      // apply ExB correction
  fApplyTOFCorrection(1),      // apply TOF correction
  fApplyPositionCorrection(1), // apply position correction
  fApplySectorAlignment(1),    // apply sector alignment
  fApplyRPhiCorrection(1),     // apply R-Phi correction
  fApplyRCorrection(1)         // apply Radial correction

{
  //
  // Constructor
  //
}


AliTPCcalibCalib::AliTPCcalibCalib(const Text_t *name, const Text_t *title) 
  :AliTPCcalibBase(),
  fApplyExBCorrection(1),      // apply ExB correction
  fApplyTOFCorrection(1),      // apply TOF correction
  fApplyPositionCorrection(1), // apply position correction
  fApplySectorAlignment(1),    // apply sector alignment
  fApplyRPhiCorrection(1),     // apply R-Phi correction
  fApplyRCorrection(1)         // apply Radial correction
{  
  SetName(name);
  SetTitle(title);
}


AliTPCcalibCalib::AliTPCcalibCalib(const AliTPCcalibCalib&calib):
  AliTPCcalibBase(calib),
  fApplyExBCorrection(calib.GetApplyExBCorrection()),
  fApplyTOFCorrection(calib.GetApplyTOFCorrection()),
  fApplyPositionCorrection(calib.GetApplyPositionCorrection()),
  fApplySectorAlignment(calib.GetApplySectorAlignment()),
  fApplyRPhiCorrection(calib.GetApplyRPhiCorrection()),
  fApplyRCorrection(calib.GetApplyRCorrection())

{
  //
  // copy constructor
  //
}

AliTPCcalibCalib &AliTPCcalibCalib::operator=(const AliTPCcalibCalib&calib){
  //
  //
  //
  ((AliTPCcalibBase *)this)->operator=(calib);
  return *this;
}


AliTPCcalibCalib::~AliTPCcalibCalib() {
  //
  // destructor
  //
}


void     AliTPCcalibCalib::Process(AliVEvent *event){
  //
  // 
  //
  if (!event) {
    return;
  }  
  AliVfriendEvent *Vfriend=event->FindFriend();
  if (!Vfriend) {
   return;
  }
  if (Vfriend->TestSkipBit()) return;
  if (GetDebugLevel()>20) printf("Hallo world: Im here\n");
  Int_t ntracks=Vfriend->GetNumberOfTracks();
  //AliTPCcalibDB::Instance()->SetExBField(fMagF);

  //
  //
  //

  for (Int_t i=0;i<ntracks;++i) {
    AliVTrack *track = event->GetVTrack(i);
    AliVfriendTrack *friendTrack = const_cast<AliVfriendTrack*>(Vfriend->GetTrack(i));
    if (!friendTrack) continue;
    //track->SetFriendTrack(friendTrack);
    fCurrentFriendTrack=friendTrack;

    AliExternalTrackParam trckIn;
    if((track->GetTrackParamIp(trckIn)) < 0) continue;

    AliExternalTrackParam trckOut;
    if((track->GetTrackParamOp(trckOut)) < 0) continue;

    AliExternalTrackParam prmtpcOut;
    if((friendTrack->GetTrackParamTPCOut(prmtpcOut)) < 0) continue;

    AliTPCseed tpcSeed;
    AliTPCseed *seed = 0;
    if (friendTrack->GetTPCseed(tpcSeed)==0) seed=&tpcSeed;
    if (!seed) continue;
    RefitTrack(track, seed, event->GetMagneticField());
    AliExternalTrackParam prmOut;
    track->GetTrackParamOp(prmOut);
    friendTrack->ResetTrackParamTPCOut(&prmOut);
    friendTrack->ResetTPCseed(seed);
  }<commit_msg>Revert "enable resetting of TPCseed via V interface": Causes segmentation faults in offline processing, seems this is not needed for online calibration. Might be a remainder from splitting the online calibration changes.<commit_after>/**************************************************************************
 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
 *                                                                        *
 * Author: The ALICE Off-line Project.                                    *
 * Contributors are mentioned in the code where appropriate.              *
 *                                                                        *
 * Permission to use, copy, modify and distribute this software and its   *
 * documentation strictly for non-commercial purposes is hereby granted   *
 * without fee, provided that the above copyright notice appears in all   *
 * copies and that both the copyright notice and this permission notice   *
 * appear in the supporting documentation. The authors make no claims     *
 * about the suitability of this software for any purpose. It is          *
 * provided "as is" without express or implied warranty.                  *
 **************************************************************************/


///////////////////////////////////////////////////////////////////////////////
//                                                                           //
//   Component for redoing the reconstruction from the clusters and tracks
//      
//   The new calibration data used 
//
//   In reality it overwrites the content of the ESD 
//    

/*

  gSystem->Load("libANALYSIS");
  gSystem->Load("libTPCcalib");
  //
  gSystem->AddIncludePath("-I$ALICE_ROOT/TPC/macros");
  gROOT->LoadMacro("$ALICE_ROOT/TPC/macros/AliXRDPROOFtoolkit.cxx+")
  AliXRDPROOFtoolkit tool; 
  TChain * chainCl = tool.MakeChain("calib.txt","Clusters",0,1);
  chainCl->Lookup();
  TChain * chainTr = tool.MakeChain("calib.txt","Tracks",0,1);
  chainTr->Lookup();



*/



//  <EMAIL>
// 
#include "AliTPCcalibCalib.h"
#include "TSystem.h"
#include "TFile.h"
#include "TTreeStream.h"
#include "AliLog.h"
#include "TTimeStamp.h"
#include "AliVEvent.h"
#include "AliVfriendEvent.h"
#include "AliVTrack.h"
#include "AliVfriendTrack.h"
#include "AliTracker.h"
#include "AliTPCClusterParam.h"
#include "AliTPCParam.h"

#include "AliTPCcalibDB.h"
#include "AliTPCTransform.h"
#include "AliTPCRecoParam.h"
#include "AliTPCreco.h"
#include "AliTPCclusterMI.h"
#include "AliTPCseed.h"
#include <TGeoManager.h>
#include <TGeoPhysicalNode.h>
#include "TDatabasePDG.h"
ClassImp(AliTPCcalibCalib)

AliTPCcalibCalib::AliTPCcalibCalib():
AliTPCcalibBase(),
  fApplyExBCorrection(1),      // apply ExB correction
  fApplyTOFCorrection(1),      // apply TOF correction
  fApplyPositionCorrection(1), // apply position correction
  fApplySectorAlignment(1),    // apply sector alignment
  fApplyRPhiCorrection(1),     // apply R-Phi correction
  fApplyRCorrection(1)         // apply Radial correction

{
  //
  // Constructor
  //
}


AliTPCcalibCalib::AliTPCcalibCalib(const Text_t *name, const Text_t *title) 
  :AliTPCcalibBase(),
  fApplyExBCorrection(1),      // apply ExB correction
  fApplyTOFCorrection(1),      // apply TOF correction
  fApplyPositionCorrection(1), // apply position correction
  fApplySectorAlignment(1),    // apply sector alignment
  fApplyRPhiCorrection(1),     // apply R-Phi correction
  fApplyRCorrection(1)         // apply Radial correction
{  
  SetName(name);
  SetTitle(title);
}


AliTPCcalibCalib::AliTPCcalibCalib(const AliTPCcalibCalib&calib):
  AliTPCcalibBase(calib),
  fApplyExBCorrection(calib.GetApplyExBCorrection()),
  fApplyTOFCorrection(calib.GetApplyTOFCorrection()),
  fApplyPositionCorrection(calib.GetApplyPositionCorrection()),
  fApplySectorAlignment(calib.GetApplySectorAlignment()),
  fApplyRPhiCorrection(calib.GetApplyRPhiCorrection()),
  fApplyRCorrection(calib.GetApplyRCorrection())

{
  //
  // copy constructor
  //
}

AliTPCcalibCalib &AliTPCcalibCalib::operator=(const AliTPCcalibCalib&calib){
  //
  //
  //
  ((AliTPCcalibBase *)this)->operator=(calib);
  return *this;
}


AliTPCcalibCalib::~AliTPCcalibCalib() {
  //
  // destructor
  //
}


void     AliTPCcalibCalib::Process(AliVEvent *event){
  //
  // 
  //
  if (!event) {
    return;
  }  
  AliVfriendEvent *Vfriend=event->FindFriend();
  if (!Vfriend) {
   return;
  }
  if (Vfriend->TestSkipBit()) return;
  if (GetDebugLevel()>20) printf("Hallo world: Im here\n");
  Int_t ntracks=Vfriend->GetNumberOfTracks();
  //AliTPCcalibDB::Instance()->SetExBField(fMagF);

  //
  //
  //

  for (Int_t i=0;i<ntracks;++i) {
    AliVTrack *track = event->GetVTrack(i);
    AliVfriendTrack *friendTrack = const_cast<AliVfriendTrack*>(Vfriend->GetTrack(i));
    if (!friendTrack) continue;
    //track->SetFriendTrack(friendTrack);
    fCurrentFriendTrack=friendTrack;

    AliExternalTrackParam trckIn;
    if((track->GetTrackParamIp(trckIn)) < 0) continue;

    AliExternalTrackParam trckOut;
    if((track->GetTrackParamOp(trckOut)) < 0) continue;

    AliExternalTrackParam prmtpcOut;
    if((friendTrack->GetTrackParamTPCOut(prmtpcOut)) < 0) continue;

    AliTPCseed tpcSeed;
    AliTPCseed *seed = 0;
    if (friendTrack->GetTPCseed(tpcSeed)==0) seed=&tpcSeed;
    if (!seed) continue;
    RefitTrack(track, seed, event->GetMagneticField());
    AliExternalTrackParam prmOut;
    track->GetTrackParamOp(prmOut);
    friendTrack->ResetTrackParamTPCOut(&prmOut);
  }
{'fraction_non_alphanumeric': 0.15565519765739386, 'fraction_numerical': 0.005856515373352855, 'mean_word_length': 3.155513307984791, 'pattern_counts': {'":': 1, '<': 19, '<?xml version=': 0, '>': 56, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 20, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4532657', 'n_tokens_mistral': 3539, 'n_tokens_neox': 3438, 'n_words': 686}