fixed clusters multiple counts
authorfronchet <fronchet@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 24 May 2011 15:51:37 +0000 (15:51 +0000)
committerfronchet <fronchet@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 24 May 2011 15:51:37 +0000 (15:51 +0000)
HLT/EMCAL/AliHLTEMCALRawHistoMaker.cxx
HLT/EMCAL/AliHLTEMCALRawHistoMakerComponent.cxx

index 5351ef5..d884318 100644 (file)
@@ -49,7 +49,7 @@ AliHLTEMCALRawHistoMaker::AliHLTEMCALRawHistoMaker():
   //fAnalyzerPtr(0),
   fEMCALConstants(NULL),
   hList(0),
-  fChannelEMap(0), fChannelTMap(0), fChannelETMap(0), h2DTRU(0), h2DSTU(0),
+  fChannelEMap(0), fChannelTMap(0), fChannelETMap(0), fCellVsEne(0),
   fClusterReaderPtr(0)
 
 {
@@ -76,17 +76,18 @@ AliHLTEMCALRawHistoMaker::AliHLTEMCALRawHistoMaker():
  
   hList = new TObjArray;
 
+  // channel histograms
   fChannelEMap = new TProfile2D *[fCaloConstants->GetNMODULES()];
   fChannelTMap = new TProfile2D *[fCaloConstants->GetNMODULES()];
   fChannelETMap = new TH2F *[fCaloConstants->GetNMODULES()];
   
-  h2DTRU = new TH2I ("h2DTRU","",24,0,24,4,0,4);
-  hList->Add(h2DTRU);
+  // cluster histograms
+  fCellVsEne = new TH2F  *[fCaloConstants->GetNMODULES()];
+
+  //  fCellVsClus = new TH1F ("fCellVsClus","",100,0,50);
+  //hList->Add(fCellVsClus);
 
-  h2DSTU = new TH2I ("h2DSTU","",24,0,24,4,0,4);
-  hList->Add(h2DSTU);
 
-  
   for (int i=0; i<fCaloConstants->GetNMODULES(); i++) {
     sprintf(title, "E(X vs Z): SM %d ", i);
     sprintf(id, "fChannelEMap%d", i);
@@ -105,6 +106,13 @@ AliHLTEMCALRawHistoMaker::AliHLTEMCALRawHistoMaker():
     fChannelETMap[i] = new TH2F(id,title,100 ,0, 50, 100, 0, 500);
     
     hList->Add(fChannelETMap[i]);
+
+    sprintf(title, "(Cell vs Energy): SM %d ", i);
+    sprintf(id, "fCellVsEne%d", i);
+    fCellVsEne[i] = new TH2F(id,title,50 ,0, 50, 10, 0, 10);
+    
+    hList->Add(fCellVsEne[i]);
+
   }
   
   
@@ -151,12 +159,15 @@ AliHLTEMCALRawHistoMaker::MakeHisto(AliHLTCaloChannelDataHeaderStruct* channelDa
        } else {
          
          // stuff to handle clusters here
-         fClusterReaderPtr->SetMemory(caloClusterHeaderPtr);
 
-         cout << "FROM HISTOMAKER WE HAVE THE CLUSTER POINTER: " << caloClusterHeaderPtr << endl;
+         fClusterReaderPtr->SetMemory(caloClusterHeaderPtr);
 
+         cout << "FROM HISTOMAKER: CLUSTER POINTER IS NON ZERO: " << caloClusterHeaderPtr << endl;
 
+         int numcl = 0 ;
+         
          while((caloClusterStructPtr = fClusterReaderPtr->NextCluster()) != 0)
+         
            { 
               
              cout << "cluster type: " << caloClusterStructPtr->fClusterType << endl;
@@ -164,8 +175,14 @@ AliHLTEMCALRawHistoMaker::MakeHisto(AliHLTCaloChannelDataHeaderStruct* channelDa
              cout << " COORDINATES FROM HISTOMAKER: " << 
                " fX:" << caloClusterStructPtr->fGlobalPos[0] <<
                " fY:" << caloClusterStructPtr->fGlobalPos[1] <<
-               " fZ:" << caloClusterStructPtr->fGlobalPos[2] << endl;
+               " fZ:" << caloClusterStructPtr->fGlobalPos[2] <<
+               " fModule: " << caloClusterStructPtr->fModule << 
+               " fCell: " << caloClusterStructPtr->fNCells   <<
+               " fEnergy " << caloClusterStructPtr->fEnergy << endl;
             
+             fCellVsEne[caloClusterStructPtr->fModule-1]->Fill(caloClusterStructPtr->fNCells, caloClusterStructPtr->fEnergy);
+             
+             numcl++;
 
              UShort_t *idArrayPtr = new UShort_t[caloClusterStructPtr->fNCells];
              Double32_t *ampFracArrayPtr = new Double32_t[caloClusterStructPtr->fNCells];
@@ -182,6 +199,8 @@ AliHLTEMCALRawHistoMaker::MakeHisto(AliHLTCaloChannelDataHeaderStruct* channelDa
              nClusters++;
 
            }
+         
+         cout << " from histo maker -----------> while ran " << numcl << " times." << endl;
 
        }
 
@@ -189,26 +208,30 @@ AliHLTEMCALRawHistoMaker::MakeHisto(AliHLTCaloChannelDataHeaderStruct* channelDa
 
        // begin scan channel data and fill histograms
 
-       fShmPtr->SetMemory(channelDataHeader);
 
-       currentchannel = fShmPtr->NextChannel();
+       if (channelDataHeader) {
+        
+         fShmPtr->SetMemory(channelDataHeader);
 
-       while(currentchannel != 0) {
-         
-         fMapperPtr->ChannelId2Coordinate(currentchannel->fChannelID, coord);
+         currentchannel = fShmPtr->NextChannel();
 
-         cout << " from histo maker ->>>>>>>>>>>>>>>>>>>>>>>>>>>>>> " << currentchannel->fEnergy << endl;
-         cout << " fX: " << coord.fX << " fZ: " << coord.fZ << endl;
-
-         fChannelTMap[coord.fModuleId]->Fill( coord.fZ,  coord.fX , currentchannel->fTime);
-         fChannelEMap[coord.fModuleId]->Fill( coord.fZ,  coord.fX , currentchannel->fEnergy);
-         fChannelETMap[coord.fModuleId]->Fill(currentchannel->fEnergy, currentchannel->fTime);
-         
-         currentchannel = fShmPtr->NextChannel(); // Get the next channel
+         while(currentchannel != 0) {
          
+           fMapperPtr->ChannelId2Coordinate(currentchannel->fChannelID, coord);
+           
+           cout << " from histo maker ->>>>>>>>>>>>>>>>>>>>>>>>>>>>>> " << currentchannel->fEnergy << endl;
+           cout << " fX: " << coord.fX << " fZ: " << coord.fZ << endl;
+           cout << " channel ID: " << currentchannel->fChannelID << endl;
+           
+           fChannelTMap[coord.fModuleId]->Fill( coord.fZ,  coord.fX , currentchannel->fTime);
+           fChannelEMap[coord.fModuleId]->Fill( coord.fZ,  coord.fX , currentchannel->fEnergy);
+           fChannelETMap[coord.fModuleId]->Fill(currentchannel->fEnergy, currentchannel->fTime);
+           
+           currentchannel = fShmPtr->NextChannel(); // Get the next channel
+           
+         }
        }
        
-       
 
 return (0); 
 }
index 9d2a12d..c72a347 100644 (file)
@@ -155,67 +155,40 @@ AliHLTEMCALRawHistoMakerComponent::DoEvent(const AliHLTComponentEventData& evtDa
 
        UInt_t specification = 0;
        
-       AliHLTCaloChannelDataHeaderStruct* tmpChannelData = 0;
-       
-       AliHLTCaloClusterHeaderStruct *caloClusterHeaderPtr = 0;
-
        for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
        {
+         
+               AliHLTCaloClusterHeaderStruct *caloClusterHeaderPtr = 0;
+               AliHLTCaloChannelDataHeaderStruct* tmpChannelData = 0;
+
                iter = blocks+ndx;
                
-               if (fBeVerbose) {
-                       PrintComponentDataTypeInfo(iter->fDataType);
-                       cout << "\nI-RAWHISTOMAKERCOMPONENT: verbose mode enabled:  " << fBeVerbose << endl;
-               }
-
+               if (fBeVerbose) 
+                 PrintComponentDataTypeInfo(iter->fDataType);
+               
                
-               if(iter->fDataType == kAliHLTDataTypeCaloCluster)
-                 {
-                   
-                   cout << "\nI-RAWHISTOMAKERCOMPONENT: cluster data handling HERE !" <<  endl;
-                   
-                   //specification |= iter->fSpecification;
-                   caloClusterHeaderPtr = reinterpret_cast<AliHLTCaloClusterHeaderStruct*>(iter->fPtr);
-                   cout << " --------------------> cluster pointer here !!!!!!!! ->>>>>>>>>>>>>>>>>>>>>: " << caloClusterHeaderPtr << endl;
-                 } 
-
-               else 
-
-                 {
-                   
-                   if (fBeVerbose)
-                     HLTWarning("\nI-RAWHISTOMAKERCOMPONENT: Data block does not contain clusters\n");
-                   else
-                     HLTDebug("\nI-RAWHISTOMAKERCOMPONENT: Data block does not contain clusters\n");
-                   
-                   // continue;
-
-                 }
-
-
                if (iter->fDataType == AliHLTEMCALDefinitions::fgkChannelDataType)
                  {
                  
-
                    tmpChannelData = reinterpret_cast<AliHLTCaloChannelDataHeaderStruct*>(iter->fPtr);
-                   cout << " --------------------> channel  pointer here !!!!!!!! ->>>>>>>>>>>>>>>>>>>>>: " << tmpChannelData  << endl;
-                   
+                                   
                    if (fBeVerbose)
-                     HLTWarning ("\nI-RAWHISTOMAKERCOMPONENT: reading channel number %d\n",tmpChannelData->fNChannels);
-
-               
+                     printf ("\nI-RAWHISTOMAKERCOMPONENT: Number of active channels in block: %d\n",tmpChannelData->fNChannels);
+                   
                  } 
-               
+
+               else if (iter->fDataType == kAliHLTDataTypeCaloCluster)
+                 caloClusterHeaderPtr = reinterpret_cast<AliHLTCaloClusterHeaderStruct*>(iter->fPtr);
+                   
                else
                  
                  {
                    if (fBeVerbose)
-                     HLTWarning("\nI-RAWHISTOMAKERCOMPONENT: Data block does not contain signal amplitude\n");
+                     HLTWarning("\nI-RAWHISTOMAKERCOMPONENT: Data block does not of channel or cluster type \n");
                    else
-                     HLTDebug("\nI-RAWHISTOMAKERCOMPONENT: Data block does not contain signal amplitude\n");
-
+                     HLTDebug("\nI-RAWHISTOMAKERCOMPONENT: Data block does not of channel or cluster type \n");
                    continue;
-         }
+                 }
 
        
                specification |= iter->fSpecification;
@@ -223,6 +196,7 @@ AliHLTEMCALRawHistoMakerComponent::DoEvent(const AliHLTComponentEventData& evtDa
 
        }
 
+
        fLocalEventCount++;
 
        TFile rootHistFile(fRootFileName,"recreate");
@@ -232,7 +206,7 @@ AliHLTEMCALRawHistoMakerComponent::DoEvent(const AliHLTComponentEventData& evtDa
        if (fLocalEventCount%fPushFraction == 0) {
          
          if (fBeVerbose)
-           cout << "I-RAWHISTOMAKERCOMPONENT: pushback done at " << fLocalEventCount << " events " << endl;
+           cout << "\nI-RAWHISTOMAKERCOMPONENT: pushback done at " << fLocalEventCount << " events " << endl;
          
          PushBack(fRawHistoMakerPtr->GetHistograms(), kAliHLTDataTypeTObjArray | kAliHLTDataOriginEMCAL , specification);
        }