]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Debug output (Printf) changes
authormarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 26 Jul 2008 10:56:13 +0000 (10:56 +0000)
committermarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 26 Jul 2008 10:56:13 +0000 (10:56 +0000)
Possibility to use  "external" gain map  (Marian Ivanov)

M      AliTPCcalibTracks.cxx        - Increase debug level for printf
M      AliTPCcalibTracksGain.cxx    - Adding optional gain normalization
M      AliTPCcalibTracksGain.h      - Adding optional gain normalization
M      AliTPCAnalysisTaskcalib.cxx  - Disable Printf
M      AliTPCcalibCosmic.cxx        - Increase debug level for info messages

TPC/AliTPCAnalysisTaskcalib.cxx
TPC/AliTPCcalibCosmic.cxx
TPC/AliTPCcalibTracks.cxx
TPC/AliTPCcalibTracksGain.cxx
TPC/AliTPCcalibTracksGain.h

index 9602687d71c7eed540d936a7423e8b791035e118..5cfafd8ca6a631c84ab7eb88a69d50441b5a4bb3 100644 (file)
@@ -76,12 +76,12 @@ void AliTPCAnalysisTaskcalib::Exec(Option_t *) {
   // Exec function
   // Loop over tracks and call  Process function
   if (!fESD) {
-    Printf("ERROR: fESD not available");
+    //Printf("ERROR: fESD not available");
     return;
   }
   fESDfriend=static_cast<AliESDfriend*>(fESD->FindListObject("AliESDfriend"));
   if (!fESDfriend) {
-    Printf("ERROR: fESDfriend not available");
+    //Printf("ERROR: fESDfriend not available");
     return;
   }
   Int_t n=fESD->GetNumberOfTracks();
@@ -108,12 +108,12 @@ void AliTPCAnalysisTaskcalib::ConnectInputData(Option_t *) {
   //
   TTree* tree=dynamic_cast<TTree*>(GetInputData(0));
   if (!tree) {
-    Printf("ERROR: Could not read chain from input slot 0");
+    //Printf("ERROR: Could not read chain from input slot 0");
   } 
   else {
     AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
     if (!esdH) {
-      Printf("ERROR: Could not get ESDInputHandler");
+      //Printf("ERROR: Could not get ESDInputHandler");
     } 
     else {
       fESD = esdH->GetEvent();
index 1fd329bcdffb3a9dc9579ba4da7e23a04670fc47..42b0f5a5b420b013529897ffa486a35df22d3226 100644 (file)
@@ -143,10 +143,10 @@ void AliTPCcalibCosmic::Process(AliESDEvent *event) {
    Printf("ERROR: ESDfriend not available");
    return;
   }
-
+   
   FindPairs(event); // nearly everything takes place in find pairs...
 
-  if (GetDebugLevel()>1) printf("Hallo world: Im here and processing an event\n");
+  if (GetDebugLevel()>20) printf("Hallo world: Im here and processing an event\n");
   Int_t ntracks=event->GetNumberOfTracks(); 
   fHistNTracks->Fill(ntracks);
   if (ntracks==0) return;
@@ -172,7 +172,7 @@ void AliTPCcalibCosmic::FindPairs(AliESDEvent *event) {
   // Track0 is choosen in upper TPC part
   // Track1 is choosen in lower TPC part
   //
-  if (GetDebugLevel()>1) printf("Hallo world: Im here\n");
+  if (GetDebugLevel()>20) printf("Hallo world: Im here\n");
   AliESDfriend *ESDfriend=static_cast<AliESDfriend*>(event->FindListObject("AliESDfriend"));
   Int_t ntracks=event->GetNumberOfTracks(); 
   TObjArray  tpcSeeds(ntracks);
@@ -483,10 +483,10 @@ void AliTPCcalibCosmic::BinLogX(TH1 *h) {
 /*
 
 void AliTPCcalibCosmic::dEdxCorrection(){
-  TCut cutT("cutT","abs(Tr1.fP[3]+Tr0.fP[3])<0.03");
-  TCut cutD("cutD","abs(Tr0.fP[0]+Tr1.fP[0])<5");
+  TCut cutT("cutT","abs(Tr1.fP[3]+Tr0.fP[3])<0.03");  // OK
+  TCut cutD("cutD","abs(Tr0.fP[0]+Tr1.fP[0])<5");     // OK
   TCut cutPt("cutPt","abs(Tr1.fP[4]+Tr0.fP[4])<0.2&&abs(Tr0.fP[4])+abs(Tr1.fP[4])<10");
-  TCut cutN("cutN","min(Orig0.fTPCncls,Orig1.fTPCncls)>110");
+  TCut cutN("cutN","min(Orig0.fTPCncls,Orig1.fTPCncls)>70");
   TCut cutA=cutT+cutD+cutPt+cutN;
 
 
index b885ece3f9690dcec17aedb3c3b49f91a3398b3b..1badb1312707ef982154d88a13f72eaaa942f318 100644 (file)
@@ -956,7 +956,7 @@ void  AliTPCcalibTracks::FillResolutionHistoLocal(AliTPCseed * track){
       
       if (useForResol && nclFound > 2 * kMinRatio * kDelta 
          && irow % kDeltaWriteDebugStream == 0 && GetDebugLevel() > 4){
-       if (GetDebugLevel() > 5) Info("FillResolutionHistoLocal","Filling 'TPCSelectorDebug.root', irow = %i", irow);
+       if (GetDebugLevel() > 20) Info("FillResolutionHistoLocal","Filling 'TPCSelectorDebug.root', irow = %i", irow);
          FillResolutionHistoLocalDebugPart(track, cluster0, irow, angley, anglez, nclFound, kDelta);
       }  // if (useForResol && nclFound > 2 * kMinRatio * kDelta)
    
index 8a446b08d4029f3f41ae39d0a9b4018f40e51251..e2d2f7e983da195992cc0a1e6f68a5718c9ca397 100644 (file)
   TObjArray * array = (TObjArray*)fcalib.Get("TPCCalib");
   AliTPCcalibTracksGain * gain = ( AliTPCcalibTracksGain *)array->FindObject("calibTracksGain");
 
+  //
+  // Angular and drift correction
+  //
+  AliTPCClusterParam *param = new AliTPCClusterParam;param->SetInstance(param);
+  gain->UpdateClusterParam(param);
+  TF2 fdrty("fdrty","AliTPCClusterParam::SQnorm(0,0,x,y,0)",0,1,0,1)
+
   //
   // Make visual Tree - compare with Kr calibration
   // 
   AliTPCCalPad * gain010 = gain->CreateFitCalPad(0,kTRUE,0); gain010->SetName("CGain010");
   AliTPCCalPad * gain110 = gain->CreateFitCalPad(1,kTRUE,0); gain110->SetName("CGain110");
   AliTPCCalPad * gain210 = gain->CreateFitCalPad(2,kTRUE,0); gain210->SetName("CGain210");
-  TFile fkr("/u/akalweit/macros/GainCalibration/GainMap.root");
+  TFile fkr("/u/miranov/GainMap.root");
   AliTPCCalPad *gainKr = fkr.Get("GainMap"); fkr->SetName("KrGain");
   //
   AliTPCPreprocessorOnline * preprocesor = new AliTPCPreprocessorOnline;
@@ -234,6 +241,7 @@ AliTPCParamSR* AliTPCcalibTracksGain::fgTPCparam = new AliTPCParamSR();
 AliTPCcalibTracksGain::AliTPCcalibTracksGain() :
   AliTPCcalibBase(),
   fCuts(0),            // cuts that are used for sieving the tracks used for calibration
+  fGainMap(0),                //  gain map to be applied
   //
   // Simple Array of histograms
   // 
@@ -271,8 +279,7 @@ AliTPCcalibTracksGain::AliTPCcalibTracksGain() :
   fTotalTracks(0),         // just for debugging
   fAcceptedTracks(0),      // just for debugging
   fDebugCalPadRaw(0),      // just for debugging
-  fDebugCalPadCorr(0),     // just for debugging
-  fPrevIter(0)        // the calibration object in its previous iteration (will not be owned by the new object, don't forget to delete it!)    
+  fDebugCalPadCorr(0)     // just for debugging
 
 {
    //
@@ -283,6 +290,7 @@ AliTPCcalibTracksGain::AliTPCcalibTracksGain() :
 AliTPCcalibTracksGain::AliTPCcalibTracksGain(const AliTPCcalibTracksGain& obj) :
   AliTPCcalibBase(obj),
   fCuts(obj.fCuts),            // cuts that are used for sieving the tracks used for calibration
+  fGainMap(new AliTPCCalPad(*(obj.fGainMap))),                //  gain map to be applied
   fArrayQM(0),                // Qmax normalized
   fArrayQT(0),                // Qtot normalized 
   //
@@ -318,8 +326,7 @@ AliTPCcalibTracksGain::AliTPCcalibTracksGain(const AliTPCcalibTracksGain& obj) :
   fTotalTracks(obj.fTotalTracks),         // just for debugging
   fAcceptedTracks(obj.fAcceptedTracks),      // just for debugging
   fDebugCalPadRaw(obj.fDebugCalPadRaw),      // just for debugging
-  fDebugCalPadCorr(obj.fDebugCalPadCorr),     // just for debugging
-  fPrevIter(obj.fPrevIter)        // the calibration object in its previous iteration (will not be owned by the new object, don't forget to delete it!)    
+  fDebugCalPadCorr(obj.fDebugCalPadCorr)     // just for debugging
 
 {
    //
@@ -340,8 +347,8 @@ AliTPCcalibTracksGain& AliTPCcalibTracksGain::operator=(const AliTPCcalibTracksG
       fSqrtFitter = new AliTPCFitPad(*(rhs.fSqrtFitter));
       fLogFitter = new AliTPCFitPad(*(rhs.fLogFitter));
       fSingleSectorFitter = new AliTPCFitPad(*(rhs.fSingleSectorFitter));
-      fPrevIter = new AliTPCcalibTracksGain(*(rhs.fPrevIter));
       fCuts = new AliTPCcalibTracksCuts(*(rhs.fCuts));
+      fGainMap = new AliTPCCalPad(*(rhs.fGainMap));
    }
    return *this;
 }
@@ -349,6 +356,7 @@ AliTPCcalibTracksGain& AliTPCcalibTracksGain::operator=(const AliTPCcalibTracksG
 AliTPCcalibTracksGain::AliTPCcalibTracksGain(const char* name, const char* title, AliTPCcalibTracksCuts* cuts, TNamed* /*debugStreamPrefix*/, AliTPCcalibTracksGain* prevIter) :
   AliTPCcalibBase(),
   fCuts(0),            // cuts that are used for sieving the tracks used for calibration
+  fGainMap(0),                //  gain map to be applied
   fArrayQM(0),                // Qmax normalized
   fArrayQT(0),                // Qtot normalized 
   //
@@ -384,17 +392,14 @@ AliTPCcalibTracksGain::AliTPCcalibTracksGain(const char* name, const char* title
   fTotalTracks(0),         // just for debugging
   fAcceptedTracks(0),      // just for debugging
   fDebugCalPadRaw(0),      // just for debugging
-  fDebugCalPadCorr(0),     // just for debugging
-  fPrevIter(0)        // the calibration object in its previous iteration (will not be owned by the new object, don't forget to delete it!)      
+  fDebugCalPadCorr(0)     // just for debugging
   
 {
    //
    // Constructor.
    //   
-   G__SetCatchException(0);
    this->SetNameTitle(name, title);
    fCuts = cuts;
-   fPrevIter = prevIter;
    //
    // Fitter initialization
    //
@@ -579,6 +584,42 @@ Long64_t AliTPCcalibTracksGain::Merge(TCollection *list) {
    return 0;
 }
 
+Float_t  AliTPCcalibTracksGain::GetGain(AliTPCclusterMI* cl){
+  //
+  // Return local gain at cluster position
+  //
+  Float_t factor = 1;
+  AliTPCCalROC * roc = fGainMap->GetCalROC(cl->GetDetector());
+  Int_t irow = cl->GetRow();
+  if (roc){
+    if (irow < 63) { // IROC
+      factor = roc->GetValue(irow, TMath::Nint(cl->GetPad()));
+    } else {         // OROC
+      factor = roc->GetValue(irow - 63, TMath::Nint(cl->GetPad()));
+    }
+  }
+  if (factor<0.1) factor=0.1;
+  return factor;
+}
+
+
+Float_t   AliTPCcalibTracksGain::GetMaxNorm(AliTPCclusterMI * cl){
+  //
+  // Get normalized amplituded if the gain map provided
+  //
+  return cl->GetMax()/GetGain(cl);
+}
+
+
+Float_t   AliTPCcalibTracksGain::GetQNorm(AliTPCclusterMI * cl){
+  //
+  // Get normalized amplituded if the gain map provided
+  //
+  return cl->GetQ()/GetGain(cl);
+}
+
+
+
 void AliTPCcalibTracksGain::Add(AliTPCcalibTracksGain* cal) {
    //
    // Adds another AliTPCcalibTracksGain object to this object.
@@ -673,46 +714,46 @@ void AliTPCcalibTracksGain::AddTrack(AliTPCseed* seed) {
 void AliTPCcalibTracksGain::AddCluster(AliTPCclusterMI* cluster){
   //
   // Adding cluster information to the simple histograms
-  // No correction, fittings are applied 
-  // 
+  // No correction, fittings are applied   
+
+
   Float_t kThreshold=5;
   if (cluster->GetX()<=0) return;
   if (cluster->GetQ()<=kThreshold) return;
   //
-  
 
   Int_t sector = cluster->GetDetector();
   TH1F  * his;
   his = GetQT(sector);
-  if (his) his->Fill(cluster->GetQ());
+  if (his) his->Fill(GetQNorm(cluster));
   his = GetQT(-1);
-  if (his) his->Fill(cluster->GetQ());
+  if (his) his->Fill(GetQNorm(cluster));
   his = GetQM(sector);
-  if (his) his->Fill(cluster->GetMax());
+  if (his) his->Fill(GetMaxNorm(cluster));
   his = GetQM(-1);
-  if (his) his->Fill(cluster->GetMax());
+  if (his) his->Fill(GetMaxNorm(cluster));
   //
   sector = sector%36;
   TProfile *prof;
   prof = GetProfileQT(sector);
-  if (prof) prof->Fill(cluster->GetX(),cluster->GetQ());
+  if (prof) prof->Fill(cluster->GetX(),GetQNorm(cluster));
   prof = GetProfileQT(-1);
-  if (prof) prof->Fill(cluster->GetX(),cluster->GetQ());
+  if (prof) prof->Fill(cluster->GetX(),GetQNorm(cluster));
   prof = GetProfileQM(sector);
-  if (prof) prof->Fill(cluster->GetX(),cluster->GetMax());
+  if (prof) prof->Fill(cluster->GetX(),GetMaxNorm(cluster));
   prof = GetProfileQM(-1);
-  if (prof) prof->Fill(cluster->GetX(),cluster->GetMax());
+  if (prof) prof->Fill(cluster->GetX(),GetMaxNorm(cluster));
   //  
   Float_t phi = cluster->GetY()/cluster->GetX();
   TProfile2D *prof2;
   prof2 = GetProfileQT2D(sector);
-  if (prof2) prof2->Fill(cluster->GetX(),phi,cluster->GetQ());
+  if (prof2) prof2->Fill(cluster->GetX(),phi,GetQNorm(cluster));
   prof2 = GetProfileQT2D(-1);
-  if (prof2) prof2->Fill(cluster->GetX(),phi,cluster->GetQ());
+  if (prof2) prof2->Fill(cluster->GetX(),phi,GetQNorm(cluster));
   prof2 = GetProfileQM2D(sector);
-  if (prof2) prof2->Fill(cluster->GetX(),phi,cluster->GetMax());
+  if (prof2) prof2->Fill(cluster->GetX(),phi,GetMaxNorm(cluster));
   prof2 = GetProfileQM2D(-1);
-  if (prof2) prof2->Fill(cluster->GetX(),phi,cluster->GetMax());
+  if (prof2) prof2->Fill(cluster->GetX(),phi,GetMaxNorm(cluster));
 
   //
 }
@@ -733,14 +774,38 @@ void AliTPCcalibTracksGain::AddCluster(AliTPCclusterMI* cluster, Float_t /*momen
    // gets the square root of the charge, and the log fitter gets fgkM*(1+q/fgkM), where q is the original charge
    // and fgkM==25.
    //
+  Float_t kedge     = 3;
+  Float_t kfraction = 0.7;
+  Int_t   kinorm    = 2;
+
+
+  // Where to put selection on threshold? 
+  // Defined by the Q/dEdxT variable - see debug streamer:
+  //
+  // Debug stream variables:  (Where tu cut ?)
+  // chain0->Draw("Cl.fQ/dedxQ.fElements[1]>>his(100,0,3)","fraction2<0.6&&dedge>3","",1000000);
+  //         mean 1  sigma 0.25
+  // chain0->Draw("Cl.fMax/dedxM.fElements[1]>>his(100,0,3)","fraction2<0.6&&dedge>3","",1000000)
+  //         mean 1  sigma 0.25
+  // chain0->Draw("Cl.fQ/dedxQ.fElements[2]>>his(100,0,3)","fraction2<0.7&&dedge>3","",1000000)
+  //         mean 1 sigma 0.29
+  // chain0->Draw("Cl.fMax/dedxM.fElements[2]>>his(100,0,3)","fraction2<0.7&&dedge>3","",1000000)
+  //         mean 1 sigma 0.27
+  // chain0->Draw("Cl.fQ/dedxQ.fElements[3]>>his(100,0,3)","fraction2<0.8&&dedge>3","",1000000)
+  //         mean 1 sigma 0.32
+  // 
+  // chain0->Draw("Cl.fQ/dedxQ.fElements[4]>>his(100,0,3)","fraction2<0.9&&dedge>3","",1000000)
+  //         mean 1 sigma 0.4
+
+  // Fraction choosen 0.7
 
    if (!cluster) {
       Error("AddCluster", "Cluster not valid.");
       return;
    }
 
-   if (dedge < 3.) return;
-   if (fraction2 > 0.9) return;
+   if (dedge < kedge) return;
+   if (fraction2 > kfraction) return;
 
    //Int_t padType = GetPadType(cluster->GetX());
    Double_t xx[7];
@@ -763,7 +828,7 @@ void AliTPCcalibTracksGain::AddCluster(AliTPCclusterMI* cluster, Float_t /*momen
    // Update fitters
    //
    Int_t segment = cluster->GetDetector() % 36;
-   Double_t q = fgkUseTotalCharge ? ((Double_t)(cluster->GetQ())) : ((Double_t)(cluster->GetMax()));  // note: no normalization to pad size!
+   Double_t q = fgkUseTotalCharge ? ((Double_t)(GetQNorm(cluster))) : ((Double_t)(GetMaxNorm(cluster)));  // note: no normalization to pad size!
 
    // just for debugging
    Int_t row = 0;
@@ -772,7 +837,7 @@ void AliTPCcalibTracksGain::AddCluster(AliTPCclusterMI* cluster, Float_t /*momen
    fDebugCalPadRaw->GetCalROC(cluster->GetDetector())->SetValue(row, pad, q + fDebugCalPadRaw->GetCalROC(cluster->GetDetector())->GetValue(row, pad));
    
    // correct charge by normalising to mean charge per track
-   q /= dedxQ[2];
+   q /= dedxQ[kinorm];
 
    // just for debugging
    fDebugCalPadCorr->GetCalROC(cluster->GetDetector())->SetValue(row, pad, q + fDebugCalPadCorr->GetCalROC(cluster->GetDetector())->GetValue(row, pad));
@@ -1247,8 +1312,8 @@ Bool_t AliTPCcalibTracksGain::GetDedx(AliTPCseed* track, Int_t padType, Int_t* /
          Int_t detector = cluster->GetDetector() ;
          if (lastSector == -1) lastSector = detector;
          if (lastSector != detector) continue;
-         amplitudeQ[nclusters] = cluster->GetQ();
-         amplitudeM[nclusters] = cluster->GetMax();
+         amplitudeQ[nclusters] = GetQNorm(cluster);
+         amplitudeM[nclusters] = GetMaxNorm(cluster);
          rowIn[nclusters] = iCluster;
          nclusters++;
          Double_t dx = cluster->GetX() - xcenter;
@@ -1343,22 +1408,23 @@ Bool_t AliTPCcalibTracksGain::GetDedx(AliTPCseed* track, Int_t padType, Int_t* /
       Float_t fraction2 = Float_t(inonEdge) / Float_t(nclustersNE);
 
       AddCluster(cluster, momenta, mdedx, padType, xcenter, dedxQ, dedxM, fraction, fraction2, dedge, parY, parZ, meanPos);
-
+      Float_t gain = GetGain(cluster);
       if (cstream) (*cstream) << "dEdx" <<
-         "Cl.=" << cluster <<           // cluster of interest
-         "P=" << momenta <<             // track momenta
-         "dedx=" << mdedx <<            // mean dedx - corrected for angle
-         "IPad=" << padType <<          // pad type 0..2
-         "xc=" << xcenter <<            // x center of chamber
-         "dedxQ.=" << &dedxQ <<         // dedxQ  - total charge
-         "dedxM.=" << &dedxM <<         // dedxM  - maximal charge
-         "fraction=" << fraction <<     // fraction - order in statistic (0,1)
-         "fraction2=" << fraction2 <<   // fraction - order in statistic (0,1)
-         "dedge=" << dedge <<           // distance to the edge
-         "parY.=" << &parY <<           // line fit
-         "parZ.=" << &parZ <<           // line fit
-         "meanPos.=" << &meanPos <<     // mean position (dx, dx^2, y,y^2, z, z^2)
-         "\n";
+                    "Cl.=" << cluster <<           // cluster of interest
+                    "gain="<<gain<<                // gain at cluster position
+                    "P=" << momenta <<             // track momenta
+                    "dedx=" << mdedx <<            // mean dedx - corrected for angle
+                    "IPad=" << padType <<          // pad type 0..2
+                    "xc=" << xcenter <<            // x center of chamber
+                    "dedxQ.=" << &dedxQ <<         // dedxQ  - total charge
+                    "dedxM.=" << &dedxM <<         // dedxM  - maximal charge
+                    "fraction=" << fraction <<     // fraction - order in statistic (0,1)
+                    "fraction2=" << fraction2 <<   // fraction - order in statistic (0,1)
+                    "dedge=" << dedge <<           // distance to the edge
+                    "parY.=" << &parY <<           // line fit
+                    "parZ.=" << &parZ <<           // line fit
+                    "meanPos.=" << &meanPos <<     // mean position (dx, dx^2, y,y^2, z, z^2)
+                    "\n";
    }
    
    if (cstream) (*cstream) << "dEdxT" <<
index 926fe5f3efa4e6f3166af1a9198227bd2db13c25..15bb9fb200773d0c7c016814a6c4e68835f03e6d 100644 (file)
@@ -62,9 +62,13 @@ public:
   virtual void            Process(AliTPCseed* seed);
   virtual void            Terminate();
   virtual void            Analyze();
+  void                    SetGainMap(AliTPCCalPad *GainMap){fGainMap = GainMap;};
   //
-  // Tracks manipulation
+  // Tracks and cluster manipulation
   //
+  Float_t         GetMaxNorm(AliTPCclusterMI * cl);
+  Float_t         GetQNorm(AliTPCclusterMI * cl);
+  Float_t         GetGain(AliTPCclusterMI* cl);
   void            AddTrack(AliTPCseed* seed);
   void            DumpTrack(AliTPCseed* track);
   Bool_t          GetDedx(AliTPCseed* track, Int_t padType,  Int_t*rows,
@@ -117,6 +121,8 @@ public:
   //
   //
   AliTPCcalibTracksCuts* fCuts;            // cuts that are used for sieving the tracks used for calibration
+  AliTPCCalPad *fGainMap;                //  gain map to be applied
+  //
   //
   // Simple Profiles and histograms - per chambers + 1 total
   //
@@ -162,7 +168,6 @@ public:
   UInt_t          fNLongClusters[36];    // number of clusters registered on long pads
   //
   //
-  AliTPCcalibTracksGain* fPrevIter;        // the calibration object in its previous iteration (will not be owned by the new object, don't forget to delete it!)    
   //
   // Setup
   //