]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/AliTPCclusterKr.cxx
TPC CA Global Merger component added
[u/mrichter/AliRoot.git] / TPC / AliTPCclusterKr.cxx
index e730fcf58f2da0d4af0c1f3412a3ecb96ad4df2c..33e0e292b920564589aecae03c6400dd6749ac17 100644 (file)
-/**************************************************************************
- * 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.                  *
- **************************************************************************/
-
-/* $Id: AliTPCclusterKr.cxx,v 1.7 2008/01/22 17:24:53 matyja Exp $ */
-
-//-----------------------------------------------------------------
-//           Implementation of the TPC Kr cluster class
-//
-// Origin: Adam Matyja, INP PAN, adam.matyja@ifj.edu.pl
-//-----------------------------------------------------------------
-
-#include "AliTPCclusterKr.h"
-#include "TObject.h"
-#include <vector>
-#include "AliTPCvtpr.h"
-
-ClassImp(AliTPCclusterKr)
-
-
-AliTPCclusterKr::AliTPCclusterKr()
-:fMax(),
-  fADCcluster(0),
-  fNsec(0),
-  fNpads(0),
-  fSize(0)
-{
-//
-// default constructor
-//
-}
-
-AliTPCclusterKr::AliTPCclusterKr(const AliTPCclusterKr &param)
-:fMax(),
-  fADCcluster(0),
-  fNsec(0),
-  fNpads(0),
-  fSize(0)
-{
-//
-// copy constructor
-//
-  fADCcluster = param.fADCcluster;
-  fNsec  = param.fNsec ;
-  fNpads = param.fNpads;
-  fMax = param.fMax;
-  fCluster=param.fCluster;
-  fSize=param.fSize;
-} 
-
-AliTPCclusterKr &AliTPCclusterKr::operator = (const AliTPCclusterKr & param)
-{
-  fADCcluster = param.fADCcluster;
-  fNsec  = param.fNsec ;
-  fNpads = param.fNpads;
-  fMax = param.fMax;
-  fCluster=param.fCluster;
-  fSize=param.fSize;
-  return (*this);
-}
-
-AliTPCclusterKr::~AliTPCclusterKr()
-{
-  //
-  // destructor
-  //
-}
+/**************************************************************************\r
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
+ *                                                                        *\r
+ * Author: The ALICE Off-line Project.                                    *\r
+ * Contributors are mentioned in the code where appropriate.              *\r
+ *                                                                        *\r
+ * Permission to use, copy, modify and distribute this software and its   *\r
+ * documentation strictly for non-commercial purposes is hereby granted   *\r
+ * without fee, provided that the above copyright notice appears in all   *\r
+ * copies and that both the copyright notice and this permission notice   *\r
+ * appear in the supporting documentation. The authors make no claims     *\r
+ * about the suitability of this software for any purpose. It is          *\r
+ * provided "as is" without express or implied warranty.                  *\r
+ **************************************************************************/\r
+\r
+/* $Id: AliTPCclusterKr.cxx,v 1.7 2008/01/22 17:24:53 matyja Exp $ */\r
+\r
+//-----------------------------------------------------------------\r
+//           Implementation of the TPC Kr cluster class\r
+//\r
+// Origin: Adam Matyja, INP PAN, adam.matyja@ifj.edu.pl\r
+//-----------------------------------------------------------------\r
+\r
+#include "AliTPCclusterKr.h"\r
+#include "AliCluster.h"\r
+#include "AliTPCvtpr.h"\r
+#include "TObjArray.h"\r
+//#include "TH1F.h"\r
+#include "TMath.h"\r
+#include "TArrayI.h"\r
+\r
+ClassImp(AliTPCclusterKr)\r
+\r
+\r
+AliTPCclusterKr::AliTPCclusterKr()\r
+:AliCluster(),\r
+ fMax(),\r
+ fADCcluster(0),\r
+ fSec(0),\r
+ fNPads(0),\r
+ fNRows(0),\r
+ fTimebins1D(0),\r
+ fPads1D(0),\r
+ fPadRMS(0),\r
+ fRowRMS(0),\r
+ fTimebinRMS(0),\r
+ fSize(0),\r
+ fCenterX(0),\r
+ fCenterY(0),\r
+ fCenterT(0),\r
+ fCluster(0)\r
+{\r
+//\r
+// default constructor\r
+//\r
+  fCluster=new TObjArray();\r
+}\r
+\r
+AliTPCclusterKr::AliTPCclusterKr(const AliTPCclusterKr &param)\r
+:AliCluster(param),\r
+ fMax(),\r
+ fADCcluster(0),\r
+ fSec(0),\r
+ fNPads(0),\r
+ fNRows(0),\r
+ fTimebins1D(0),\r
+ fPads1D(0),\r
+ fPadRMS(0),\r
+ fRowRMS(0),\r
+ fTimebinRMS(0),\r
+ fSize(0),\r
+ fCenterX(0),\r
+ fCenterY(0),\r
+ fCenterT(0),\r
+ fCluster(0)\r
+{\r
+//\r
+// copy constructor\r
+//\r
+  fADCcluster = param.fADCcluster;\r
+  fSec  = param.fSec ;\r
+  fNPads = param.fNPads;\r
+  fNRows = param.fNRows;\r
+  fMax = param.fMax;\r
+  //  fCluster = param.fCluster;\r
+  fCenterX = param.fCenterX;\r
+  fCenterY = param.fCenterY;\r
+  fCenterT = param.fCenterT;\r
+  fCluster=new TObjArray(*(param.fCluster));\r
+  fSize = param.fSize;\r
+  fTimebins1D = param.fTimebins1D;\r
+  fPads1D = param.fPads1D;\r
+  fPadRMS = param.fPadRMS;\r
+  fRowRMS = param.fRowRMS;\r
+  fTimebinRMS = param.fTimebinRMS;\r
+} \r
+\r
+AliTPCclusterKr &AliTPCclusterKr::operator = (const AliTPCclusterKr & param)\r
+{\r
+  //\r
+  // assignment operator\r
+  // \r
+  (AliCluster&)(*this) = (AliCluster&)param;\r
+  fADCcluster = param.fADCcluster;\r
+  fSec  = param.fSec ;\r
+  fNPads = param.fNPads;\r
+  fNRows = param.fNRows;\r
+  fMax = param.fMax;\r
+  //  fCluster=param.fCluster;\r
+  fCenterX = param.fCenterX;\r
+  fCenterY = param.fCenterY;\r
+  fCenterT = param.fCenterT;\r
+  delete fCluster;\r
+  fCluster=new TObjArray(*(param.fCluster));\r
+  fSize=param.fSize;\r
+  fTimebins1D = param.fTimebins1D;\r
+  fPads1D = param.fPads1D;\r
+  fPadRMS = param.fPadRMS;\r
+  fRowRMS = param.fRowRMS;\r
+  fTimebinRMS = param.fTimebinRMS;\r
+  return (*this);\r
+}\r
+\r
+AliTPCclusterKr::~AliTPCclusterKr()\r
+{\r
+  //\r
+  // destructor\r
+  //\r
+  if(fCluster) {\r
+    fCluster->SetOwner(kTRUE);\r
+    fCluster->Delete();\r
+    delete fCluster;\r
+  }\r
+  fCluster=0;\r
+}\r
+\r
+////____________________________________________________________________________\r
+void AliTPCclusterKr::SetCenter(){\r
+  //\r
+  // calculate geometrical center of the cluster\r
+  //\r
+  Double_t rX=0;\r
+  Double_t rY=0;\r
+  Double_t rT=0;\r
+\r
+  Short_t adc;\r
+  fADCcluster=0;\r
+  for(Int_t iter = 0; iter < fCluster->GetEntriesFast(); ++iter) {\r
+    AliTPCvtpr *iclus=(AliTPCvtpr *)fCluster->At(iter);\r
+\r
+    //for( std::vector<AliTPCvtpr*>::iterator iclus  = fCluster.begin();\r
+    //iclus != fCluster.end(); ++iclus ) {\r
+    adc = (iclus)->GetAdc();\r
+    fADCcluster+=adc;\r
+    rX += ((iclus)->GetX() * adc);\r
+    rY += ((iclus)->GetY() * adc);\r
+    rT += ((iclus)->GetT() * adc);\r
+  }\r
+  fCenterX=rX/fADCcluster;\r
+  fCenterY=rY/fADCcluster;\r
+  fCenterT=rT/fADCcluster;\r
+\r
+  return;\r
+}\r
+\r
+void AliTPCclusterKr::SetPadRMS(){\r
+  //\r
+  // calculate RMS in pad direction\r
+  //\r
+  //  TH1F *histo= new TH1F("","",200,0,200);\r
+  TArrayI *array= new TArrayI(fCluster->GetEntriesFast());\r
+  for(Int_t i=0;i<fCluster->GetEntriesFast();i++)\r
+    {\r
+      array->SetAt(((AliTPCvtpr *)(fCluster->At(i)))->GetPad(),i);\r
+      //histo->Fill( ((AliTPCvtpr *)(fCluster->At(i)))->GetPad() );\r
+    }\r
+  //  fPadRMS=histo->GetRMS();\r
+  fPadRMS=TMath::RMS(array->GetSize(),array->GetArray());\r
+  //  delete histo;\r
+  delete array;\r
+  return;\r
+}\r
+\r
+void AliTPCclusterKr::SetRowRMS(){\r
+  //\r
+  // calculate RMS in row direction\r
+  //\r
+  TArrayI *array= new TArrayI(fCluster->GetEntriesFast());\r
+  //  TH1F *histo= new TH1F("","",120,0,120);\r
+  for(Int_t i=0;i<fCluster->GetEntriesFast();i++)\r
+    {\r
+      array->SetAt(((AliTPCvtpr *)(fCluster->At(i)))->GetRow(),i);\r
+      //      histo->Fill( ((AliTPCvtpr *)(fCluster->At(i)))->GetRow() );\r
+    }\r
+  //  fRowRMS=histo->GetRMS();\r
+  fRowRMS=TMath::RMS(array->GetSize(),array->GetArray());\r
+  //  delete histo;\r
+  delete array;\r
+  return;\r
+}\r
+\r
+void AliTPCclusterKr::SetTimebinRMS(){\r
+  //\r
+  // calculate RMS in timebin direction\r
+  //\r
+  TArrayI *array= new TArrayI(fCluster->GetEntriesFast());\r
+  //  TH1F *histo= new TH1F("","",1000,0,1000);\r
+  for(Int_t i=0;i<fCluster->GetEntriesFast();i++)\r
+    {\r
+      array->SetAt(((AliTPCvtpr *)(fCluster->At(i)))->GetTime(),i);\r
+      //      histo->Fill( ((AliTPCvtpr *)(fCluster->At(i)))->GetTime() );\r
+    }\r
+  fTimebinRMS=TMath::RMS(array->GetSize(),array->GetArray());\r
+  //histo->GetRMS();\r
+  //  delete histo;\r
+  delete array;\r
+  return;\r
+}\r
+\r
+void AliTPCclusterKr::SetRMS(){\r
+  //\r
+  // calculate RMS in pad,row,timebin direction\r
+  //\r
+  TArrayI *arrayPad = new TArrayI(fCluster->GetEntriesFast());\r
+  TArrayI *arrayRow = new TArrayI(fCluster->GetEntriesFast());\r
+  TArrayI *arrayTime= new TArrayI(fCluster->GetEntriesFast());\r
+  //  TH1F *histoPad= new TH1F("p","p",200,0,200);\r
+  //  TH1F *histoRow= new TH1F("r","r",120,0,120);\r
+  //  TH1F *histoTime= new TH1F("t","t",1000,0,1000);\r
+  for(Int_t i=0;i<fCluster->GetEntriesFast();i++)\r
+    {\r
+      arrayPad->SetAt(((AliTPCvtpr *)(fCluster->At(i)))->GetPad(),i);\r
+      arrayRow->SetAt(((AliTPCvtpr *)(fCluster->At(i)))->GetRow(),i);\r
+      arrayTime->SetAt(((AliTPCvtpr *)(fCluster->At(i)))->GetTime(),i);\r
+\r
+      //histoPad->Fill( ((AliTPCvtpr *)(fCluster->At(i)))->GetPad() );\r
+      //histoRow->Fill( ((AliTPCvtpr *)(fCluster->At(i)))->GetRow() );\r
+      //histoTime->Fill( ((AliTPCvtpr *)(fCluster->At(i)))->GetTime() );\r
+    }\r
+  //  fPadRMS=histoPad->GetRMS();\r
+  fPadRMS=TMath::RMS(arrayPad->GetSize(),arrayPad->GetArray());\r
+  fRowRMS=TMath::RMS(arrayRow->GetSize(),arrayRow->GetArray());\r
+    //histoRow->GetRMS();\r
+  fTimebinRMS=TMath::RMS(arrayTime->GetSize(),arrayTime->GetArray());\r
+    //histoTime->GetRMS();\r
+\r
+  delete arrayPad;\r
+  delete arrayRow;\r
+  delete arrayTime;\r
+  //  delete histoPad;\r
+  //  delete histoRow;\r
+  //  delete histoTime;\r
+\r
+  return;\r
+}\r
+\r
+\r
+void AliTPCclusterKr::Set1D(){\r
+  //\r
+  //\r
+  //\r
+  Short_t maxTime=0;\r
+  Short_t minTime=1000;\r
+  Short_t maxPad=0;\r
+  Short_t minPad=1000;\r
\r
+  for(Int_t i=0;i<fCluster->GetEntriesFast();i++)\r
+    {\r
+      if(((AliTPCvtpr *)(fCluster->At(i)))->GetPad()>maxPad)maxPad   =((AliTPCvtpr *)(fCluster->At(i)))->GetPad();\r
+      if(((AliTPCvtpr *)(fCluster->At(i)))->GetPad()<minPad)minPad   =((AliTPCvtpr *)(fCluster->At(i)))->GetPad();\r
+      if(((AliTPCvtpr *)(fCluster->At(i)))->GetTime()>maxTime)maxTime=((AliTPCvtpr *)(fCluster->At(i)))->GetTime();\r
+      if(((AliTPCvtpr *)(fCluster->At(i)))->GetTime()<minTime)minTime=((AliTPCvtpr *)(fCluster->At(i)))->GetTime();\r
+    }\r
+  fPads1D=maxPad-minPad+1;\r
+  fTimebins1D=maxTime-minTime+1;\r
+  return;\r
+}\r