Bugs squashed.
authorpolicheh <policheh@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 12 Mar 2010 15:38:14 +0000 (15:38 +0000)
committerpolicheh <policheh@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 12 Mar 2010 15:38:14 +0000 (15:38 +0000)
PHOS/PHOSPEDda.cxx

index 38d2f6d..bb0974f 100644 (file)
@@ -6,9 +6,9 @@ DA type: MON
 number of events needed: 200\r
 input files: Mod0RCU0.data Mod0RCU1.data Mod0RCU2.data Mod0RCU3.data Mod1RCU0.data Mod1RCU1.data Mod1RCU2.data Mod1RCU3.data Mod2RCU0.data Mod2RCU1.data Mod2RCU2.data Mod2RCU3.data Mod3RCU0.data Mod3RCU1.data Mod3RCU2.data Mod3RCU3.data Mod4RCU0.data Mod4RCU1.data Mod4RCU2.data Mod4RCU3.data\r
 Output files: PHOS_PED.root\r
+Trigger types used: \r
 */\r
 \r
-\r
 #include "event.h"\r
 #include "monitor.h"\r
 \r
@@ -29,6 +29,8 @@ extern "C" {
 #include <TH2F.h>\r
 #include <TString.h>\r
 #include "AliRawReader.h"\r
+#include "AliRawReaderDate.h"\r
+#include "AliCaloAltroMapping.h"\r
 #include "AliCaloRawStreamV3.h"\r
 #include "AliLog.h"\r
 \r
@@ -257,144 +259,57 @@ int main(int argc, char **argv)
     eventT=event->eventType;\r
     \r
     if (eventT==PHYSICS_EVENT) {\r
-\r
+      \r
       reader = new AliRawReaderDate((void*)event);\r
       stream =  new AliCaloRawStreamV3(reader,"PHOS",mapping);\r
 \r
-      while (reader->NextEvent()) {\r
-       runNum = reader->GetRunNumber();\r
-       while (stream->NextDDL()) {\r
-         while (stream->NextChannel()) {\r
-           module   = stream->GetModule();\r
-           cellX    = stream->GetCellX();\r
-           cellZ    = stream->GetCellZ();\r
-           caloFlag = stream->GetCaloFlag();\r
-           if (caloFlag!=0 && caloFlag!=1) continue;\r
-\r
-           hHWaddr->Fill(stream->GetDDLNumber(),stream->GetHWAddress());\r
-           hModule->Fill(module);\r
-           if (!hPed[module][caloFlag][cellX][cellZ]) {\r
-             TString name  = baseNamePed;\r
-             TString title = baseTitlePed;\r
-             name +="_g"; name +=caloFlag;\r
-             name +="_m"; name +=module;\r
-             name +="_x"; name +=cellX;\r
-             name +="_z"; name +=cellZ;\r
-\r
-             title +=module; title +=",";\r
-             title +=cellX; title +=",";\r
-             title +=cellZ; title +="), ";\r
-             title +=sgain[caloFlag];\r
-             \r
-             Int_t nx,xmin,xmax;\r
-             if (caloFlag==0 || caloFlag==1) {\r
-               nx=100;\r
-               xmin=0.;\r
-               xmax=100.;\r
-             }\r
-             else {\r
-               nx=1000;\r
-               xmin=0.;\r
-               xmax=1000.;\r
-             }\r
-             hPed[module][caloFlag][cellX][cellZ] = new TH1F(name,title,100,0.,100.);\r
-             hPed[module][caloFlag][cellX][cellZ]->Sumw2();\r
-             hPed[module][caloFlag][cellX][cellZ]->SetMarkerStyle(20);\r
-             hPed[module][caloFlag][cellX][cellZ]->SetOption("eph");\r
-           }\r
-\r
-           Int_t nBunches = 0;\r
-           while (stream->NextBunch()) {\r
-             nBunches++;\r
-             const UShort_t *sig = stream->GetSignals();\r
-             Int_t sigLength = stream->GetBunchLength();\r
-             for (Int_t i = 0; i < sigLength; i++) {\r
-               hPed[module][caloFlag][cellX][cellZ]->Fill(sig[i]);\r
-             }\r
-           }\r
-           hNBunches->Fill(nBunches);\r
-         } // end of NextChannel()\r
-\r
-       } // end of NextDDL()\r
-      } // end of nextEvent()\r
-      \r
-      // Fill 2-dim histograms for mean, rms and n pedestals\r
-      \r
-      for (Int_t mod=2; mod<=4; mod++) {\r
-       for (Int_t caloFlag=0; caloFlag<2; caloFlag++) {\r
-         for (Int_t cellX=0; cellX<cellXMax; cellX++) {\r
-           for (Int_t cellZ=0; cellZ<cellZMax; cellZ++) {\r
-             if (hPed[mod][caloFlag][cellX][cellZ] != 0) {\r
-               if      (caloFlag == 0) {\r
-                 if (mod==2) {\r
-                   hPedLoMean1m2->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetMean());\r
-                   hPedLoRMS1m2 ->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetRMS());\r
-                   hPedLoMeanm2 ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetMean());\r
-                   hPedLoRMSm2  ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetRMS());\r
-                   hPedLoNumm2  ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetEntries());\r
-                 }\r
-                 else if (mod==3) {\r
-                   hPedLoMean1m3->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetMean());\r
-                   hPedLoRMS1m3 ->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetRMS());\r
-                   hPedLoMeanm3 ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetMean());\r
-                   hPedLoRMSm3  ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetRMS());\r
-                   hPedLoNumm3  ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetEntries());\r
-                 }\r
-                 else if (mod==4) {\r
-                   hPedLoMean1m4->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetMean());\r
-                   hPedLoRMS1m4 ->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetRMS());\r
-                   hPedLoMeanm4 ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetMean());\r
-                   hPedLoRMSm4  ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetRMS());\r
-                   hPedLoNumm4  ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetEntries());\r
-                 }\r
-               }\r
-               else if (caloFlag == 1) {\r
-                 if (mod==2) {\r
-                   hPedHiMean1m2->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetMean());\r
-                   hPedHiRMS1m2 ->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetRMS() );\r
-                   hPedHiMeanm2 ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetMean());\r
-                   hPedHiRMSm2  ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetRMS());\r
-                   hPedHiNumm2  ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetEntries());\r
-                 }\r
-                 if (mod==3) {\r
-                   hPedHiMean1m3->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetMean());\r
-                   hPedHiRMS1m3 ->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetRMS() );\r
-                   hPedHiMeanm3 ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetMean());\r
-                   hPedHiRMSm3  ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetRMS());\r
-                   hPedHiNumm3  ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetEntries());\r
-                 }\r
-                 if (mod==4) {\r
-                   hPedHiMean1m4->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetMean());\r
-                   hPedHiRMS1m4 ->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetRMS());\r
-                   hPedHiMeanm4 ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetMean());\r
-                   hPedHiRMSm4  ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetRMS());\r
-                   hPedHiNumm4  ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetEntries());\r
-                 }\r
-               }\r
-               else if (caloFlag == 2) {\r
-                 if (mod==2) {\r
-                   hPedTRUMean1m2->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetMean());\r
-                   hPedTRURMS1m2 ->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetRMS() );\r
-                 }\r
-                 if (mod==3) {\r
-                   hPedTRUMean1m3->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetMean());\r
-                   hPedTRURMS1m3 ->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetRMS() );\r
-                 }\r
-                 if (mod==4) {\r
-                   hPedTRUMean1m4->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetMean());\r
-                   hPedTRURMS1m4 ->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetRMS() );\r
-                 }\r
-               }\r
-             }\r
+      runNum = reader->GetRunNumber();\r
+      while (stream->NextDDL()) {\r
+       while (stream->NextChannel()) {\r
+         module   = stream->GetModule();\r
+         cellX    = stream->GetCellX();\r
+         cellZ    = stream->GetCellZ();\r
+         caloFlag = stream->GetCaloFlag();\r
+         if (caloFlag!=0 && caloFlag!=1) continue;\r
+\r
+         hHWaddr->Fill(stream->GetDDLNumber(),stream->GetHWAddress());\r
+         hModule->Fill(module);\r
+         if (!hPed[module][caloFlag][cellX][cellZ]) {\r
+           TString name  = baseNamePed;\r
+           TString title = baseTitlePed;\r
+           name +="_g"; name +=caloFlag;\r
+           name +="_m"; name +=module;\r
+           name +="_x"; name +=cellX;\r
+           name +="_z"; name +=cellZ;\r
+           \r
+           title +=module; title +=",";\r
+           title +=cellX; title +=",";\r
+           title +=cellZ; title +="), ";\r
+           title +=sgain[caloFlag];\r
+           \r
+           hPed[module][caloFlag][cellX][cellZ] = new TH1F(name,title,100,0.,100.);\r
+           hPed[module][caloFlag][cellX][cellZ]->Sumw2();\r
+           hPed[module][caloFlag][cellX][cellZ]->SetMarkerStyle(20);\r
+           hPed[module][caloFlag][cellX][cellZ]->SetOption("eph");\r
+         }\r
+           \r
+         Int_t nBunches = 0;\r
+         while (stream->NextBunch()) {\r
+           nBunches++;\r
+           const UShort_t *sig = stream->GetSignals();\r
+           Int_t sigLength = stream->GetBunchLength();\r
+           for (Int_t i = 0; i < sigLength; i++) {\r
+             hPed[module][caloFlag][cellX][cellZ]->Fill(sig[i]);\r
            }\r
          }\r
-       }\r
-      }\r
+         hNBunches->Fill(nBunches);\r
+       } // end of NextChannel()\r
+      } // end of NextDDL()\r
       \r
-      delete rawReader;     \r
+      delete reader;     \r
       delete stream;\r
       nevents_physics++;\r
-    } // end of if (eventT==PHYSICS_EVENT)\r
+    } // end of if(eventT==PHYSICS_EVENT)\r
     \r
     nevents_total++;\r
     \r
@@ -410,6 +325,79 @@ int main(int argc, char **argv)
   } // end of inf. loop over events\r
   \r
   for(Int_t i = 0; i < 20; i++) delete mapping[i];\r
+\r
+  // Fill 2-dim histograms for mean, rms and n pedestals\r
+  \r
+  for (Int_t mod=2; mod<=4; mod++) {\r
+    for (Int_t caloFlag=0; caloFlag<2; caloFlag++) {\r
+      for (Int_t cellX=0; cellX<cellXMax; cellX++) {\r
+       for (Int_t cellZ=0; cellZ<cellZMax; cellZ++) {\r
+         if (hPed[mod][caloFlag][cellX][cellZ] != 0) {\r
+           if      (caloFlag == 0) {\r
+             if (mod==2) {\r
+               hPedLoMean1m2->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetMean());\r
+               hPedLoRMS1m2 ->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetRMS());\r
+               hPedLoMeanm2 ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetMean());\r
+               hPedLoRMSm2  ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetRMS());\r
+               hPedLoNumm2  ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetEntries());\r
+             }\r
+             else if (mod==3) {\r
+               hPedLoMean1m3->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetMean());\r
+               hPedLoRMS1m3 ->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetRMS());\r
+               hPedLoMeanm3 ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetMean());\r
+               hPedLoRMSm3  ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetRMS());\r
+               hPedLoNumm3  ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetEntries());\r
+             }\r
+             else if (mod==4) {\r
+               hPedLoMean1m4->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetMean());\r
+               hPedLoRMS1m4 ->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetRMS());\r
+               hPedLoMeanm4 ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetMean());\r
+               hPedLoRMSm4  ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetRMS());\r
+               hPedLoNumm4  ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetEntries());\r
+             }\r
+           }\r
+           else if (caloFlag == 1) {\r
+             if (mod==2) {\r
+               hPedHiMean1m2->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetMean());\r
+               hPedHiRMS1m2 ->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetRMS() );\r
+               hPedHiMeanm2 ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetMean());\r
+               hPedHiRMSm2  ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetRMS());\r
+               hPedHiNumm2  ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetEntries());\r
+             }\r
+             if (mod==3) {\r
+               hPedHiMean1m3->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetMean());\r
+               hPedHiRMS1m3 ->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetRMS() );\r
+               hPedHiMeanm3 ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetMean());\r
+               hPedHiRMSm3  ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetRMS());\r
+               hPedHiNumm3  ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetEntries());\r
+             }\r
+             if (mod==4) {\r
+               hPedHiMean1m4->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetMean());\r
+               hPedHiRMS1m4 ->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetRMS());\r
+               hPedHiMeanm4 ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetMean());\r
+               hPedHiRMSm4  ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetRMS());\r
+               hPedHiNumm4  ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetEntries());\r
+             }\r
+           }\r
+           else if (caloFlag == 2) {\r
+             if (mod==2) {\r
+               hPedTRUMean1m2->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetMean());\r
+               hPedTRURMS1m2 ->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetRMS() );\r
+             }\r
+             if (mod==3) {\r
+               hPedTRUMean1m3->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetMean());\r
+               hPedTRURMS1m3 ->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetRMS() );\r
+             }\r
+             if (mod==4) {\r
+               hPedTRUMean1m4->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetMean());\r
+               hPedTRURMS1m4 ->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetRMS() );\r
+             }\r
+           }\r
+         }\r
+       }\r
+      }\r
+    }\r
+  }\r
   \r
   // Write existing histograms to a root file\r
   \r