]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSClusterFinderV2.cxx
Fix of parsing bug related to the reading of the calib header. Added consistency...
[u/mrichter/AliRoot.git] / ITS / AliITSClusterFinderV2.cxx
index 6e675d19d63fb3ba80e3b7a8760f55064dff4566..b85baa66ec29012786ebd32a05e83bc88ee3763d 100644 (file)
@@ -37,14 +37,16 @@ fNModules(AliITSgeomTGeo::GetNModules()),
 fEvent(0){
   //Default constructor
 }
-/*
+
 //______________________________________________________________________
-AliITSClusterFinderV2::AliITSClusterFinderV2(const AliITSClusterFinderV2 &source) : AliITSClusterFinder(source) {
+AliITSClusterFinderV2::AliITSClusterFinderV2(const AliITSClusterFinderV2 &source) : AliITSClusterFinder(source),
+fNModules(source.fNModules),
+fEvent(source.fEvent) {
   // Copy constructor
   // Copies are not allowed. The method is protected to avoid misuse.
-  Fatal("AliITSClusterFinderV2","Copy constructor not allowed\n");
+  AliError("Copy constructor not allowed\n");
 }
-*/
+
 //______________________________________________________________________
 //AliITSClusterFinderV2& AliITSClusterFinderV2::operator=(const AliITSClusterFinderV2& /* source */){
   // Assignment operator
@@ -59,19 +61,23 @@ void AliITSClusterFinderV2::CheckLabels2(Int_t lab[10]) {
   //------------------------------------------------------------
   // Tries to find mother's labels
   //------------------------------------------------------------
-  Int_t nlabels =0; 
-  for (Int_t i=0;i<10;i++) if (lab[i]>=0) nlabels++;
-  if(nlabels == 0) return; // In case of no labels just exit
+  AliRunLoader *rl = AliRunLoader::GetRunLoader();
+  TTree *trK=(TTree*)rl->TreeK();
+
+  if(trK){
+    Int_t nlabels =0; 
+    for (Int_t i=0;i<10;i++) if (lab[i]>=0) nlabels++;
+    if(nlabels == 0) return; // In case of no labels just exit
 
 
-  Int_t ntracks = gAlice->GetMCApp()->GetNtrack();
+    Int_t ntracks = gAlice->GetMCApp()->GetNtrack();
 
-  for (Int_t i=0;i<10;i++){
-    Int_t label = lab[i];
-    if (label>=0 && label<ntracks) {
-      TParticle *part=(TParticle*)gAlice->GetMCApp()->Particle(label);
+    for (Int_t i=0;i<10;i++){
+      Int_t label = lab[i];
+      if (label>=0 && label<ntracks) {
+       TParticle *part=(TParticle*)gAlice->GetMCApp()->Particle(label);
 
-      if (part->P() < 0.02) {
+       if (part->P() < 0.02) {
          Int_t m=part->GetFirstMother();
          if (m<0) {    
            continue;
@@ -80,66 +86,69 @@ void AliITSClusterFinderV2::CheckLabels2(Int_t lab[10]) {
            continue;
          }
          lab[i]=m;       
+       }
+       else
+         if (part->P() < 0.12 && nlabels>3) {
+           lab[i]=-2;
+           nlabels--;
+         } 
       }
-      else
-       if (part->P() < 0.12 && nlabels>3) {
+      else{
+       if ( (label>ntracks||label <0) && nlabels>3) {
          lab[i]=-2;
          nlabels--;
        } 
-    }
-    else{
-      if ( (label>ntracks||label <0) && nlabels>3) {
-       lab[i]=-2;
-       nlabels--;
-      } 
-    }
-  }  
-  if (nlabels>3){
-    for (Int_t i=0;i<10;i++){
-      if (nlabels>3){
-       Int_t label = lab[i];
-       if (label>=0 && label<ntracks) {
-         TParticle *part=(TParticle*)gAlice->GetMCApp()->Particle(label);
-         if (part->P() < 0.1) {
-           lab[i]=-2;
-           nlabels--;
+      }
+    }  
+    if (nlabels>3){
+      for (Int_t i=0;i<10;i++){
+       if (nlabels>3){
+         Int_t label = lab[i];
+         if (label>=0 && label<ntracks) {
+           TParticle *part=(TParticle*)gAlice->GetMCApp()->Particle(label);
+           if (part->P() < 0.1) {
+             lab[i]=-2;
+             nlabels--;
+           }
          }
        }
       }
     }
-  }
 
-  //compress labels -- if multi-times the same
-  Int_t lab2[10];
-  for (Int_t i=0;i<10;i++) lab2[i]=-2;
-  for (Int_t i=0;i<10  ;i++){
-    if (lab[i]<0) continue;
-    for (Int_t j=0;j<10 &&lab2[j]!=lab[i];j++){
-      if (lab2[j]<0) {
-       lab2[j]= lab[i];
-       break;
+    //compress labels -- if multi-times the same
+    Int_t lab2[10];
+    for (Int_t i=0;i<10;i++) lab2[i]=-2;
+    for (Int_t i=0;i<10  ;i++){
+      if (lab[i]<0) continue;
+      for (Int_t j=0;j<10 &&lab2[j]!=lab[i];j++){
+       if (lab2[j]<0) {
+         lab2[j]= lab[i];
+         break;
+       }
       }
     }
-  }
-  for (Int_t j=0;j<10;j++) lab[j]=lab2[j];
+    for (Int_t j=0;j<10;j++) lab[j]=lab2[j];
   
+  }
 }
 
 //______________________________________________________________________
 void AliITSClusterFinderV2::AddLabel(Int_t lab[10], Int_t label) {
-
   //add label to the cluster
+  AliRunLoader *rl = AliRunLoader::GetRunLoader();
+  TTree *trK=(TTree*)rl->TreeK();
+  if(trK){
+    if(label<0) return; // In case of no label just exit
 
-  if(label<0) return; // In case of no label just exit
-
-  Int_t ntracks = gAlice->GetMCApp()->GetNtrack();
-  if (label>ntracks) return;
-  for (Int_t i=0;i<10;i++){
-    //    if (label<0) break;
-    if (lab[i]==label) break;
-    if (lab[i]<0) {
-      lab[i]= label;
-      break;
+    Int_t ntracks = gAlice->GetMCApp()->GetNtrack();
+    if (label>ntracks) return;
+    for (Int_t i=0;i<10;i++){
+      //    if (label<0) break;
+      if (lab[i]==label) break;
+      if (lab[i]<0) {
+       lab[i]= label;
+       break;
+      }
     }
   }
 }